Skip to content

Authentication

Logging in and out, and renewing the access token.

Log In

Logs a user in with their email and password, and starts a session.

Method Path
POST /api/v1/auth/login

Request Body

Field Type Required Description
email string Yes Email address, in any case.
password string Yes Password.

Response Fields

Field Type Description
message string Login successful.
token string Access token, valid for 15 minutes.

Sample Request

{
    "email": "[email protected]",
    "password": "correct horse"
}

Sample Response

{
    "result": {
        "message": "Login successful",
        "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
    }
}

Refresh the Access Token

Returns a new access token for the current session.

Method Path
POST /api/v1/auth/refresh

Response Fields

Field Type Description
token string Access token, valid for 15 minutes.

Sample Response

{
    "result": {
        "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
    }
}

Log Out

Ends the current session, and logs out of the identity provider for a single sign-on session.

Method Path
POST /api/v1/auth/logout

Response Fields

Field Type Description
redirect_url string Logout URL of the identity provider.

Sample Response

{
    "result": {
        "redirect_url": "https://idp.example.com/realms/psap/protocol/openid-connect/logout?client_id=psap&post_logout_redirect_uri=https%3A%2F%2Fpsap.example.com%2Flogin"
    }
}

Get the Single Sign-On Option

Returns whether users can log in through the identity provider.

Method Path
GET /api/v1/auth/oidc

Response Fields

Field Type Description
enabled boolean Single sign-on is enabled.
display_name string Name on the login button.

Sample Response

{
    "result": {
        "enabled": true,
        "display_name": "Keycloak"
    }
}

Log In Through the Identity Provider

Sends the browser to the identity provider to log in.

Method Path
GET /api/v1/auth/oidc/login

Query Parameters

Name In Type Description
link query string 1 links the identity provider account to the user of the session cookie, and redirects to /profile, or /profile?error=<error>.

Return From the Identity Provider

Completes a login through the identity provider and starts a session.

Method Path
GET /api/v1/auth/oidc/callback

Errors

Error Description
rate_limited Too many logins from the address.
unavailable Single sign-on is off, or the identity provider cannot be reached.
failed The login expired, was already used or is invalid, the single sign-on settings changed during it, or the identity provider returned an error.
denied The user or the identity provider refused access.
not_set_up The identity provider gives no email, or no user has it and no group mapping is set.
email_not_verified The identity provider marks the email as not verified, or does not say and trust_unverified_email is off.
linked_elsewhere The user with the email is linked to another account at the identity provider.
link_required The user has a password and must link the account from their profile.
no_group None of the user's groups is mapped to a role.
groups_overage The user is in too many groups for the identity provider to list them.
too_many_users 50 users exist.
error Internal error.