# Auth

## Login route

Login is done per site.

`GET /oauth/site/:SITE_ID/login`

The user is then send to the authentication server with oAuth clientId set in the siteConfig. And is authenticated through the oAuth 2.0 protocol by the auth server.

After successful authentication the Api redirects back to the Frontend / CMS with a JWT token in the url that the frontend server can use for authenticating requests.

Like so:

`X-Authorization: Bearer JWT`

Named `X-Authorization` so it won't collide with Basic Authentications headers.

Following urls can be used to get user info with the JWT token.

`GET /oauth/site/:SITE_ID/me`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.openstad.org/openstad/technical/api/auth.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
