Skip to main content

Issue access and refresh tokens using API key

POST 

/auth/tokens

Exchange an API key for access and refresh tokens.

Algorithm:

  1. Hash API key with SHA-256
  2. Search user in Keycloak by api_key_hash attribute
  3. If found, get company_id from user's fortis.companies attribute
  4. Get token-exchanger service account token from Keycloak
  5. Perform token exchange (impersonation) with company_id to obtain company-scoped tokens
  6. Return access_token + refresh_token to client

NOTE: This operation is duplicated in keycloak-client/openapi.yaml. Keep both in sync.

Request

Body

required

    api_key stringrequired

    Possible values: non-empty and <= 256 characters

    The API key to authenticate the request

Responses

Tokens issued successfully

Schema

    access_token stringrequired

    Possible values: <= 8000 characters

    The access token. It is possible to decrypt the token using https://www.jwt.io resource

    refresh_token string

    Possible values: <= 8000 characters

    A credential used to obtain a new Access Token without requiring the user to re-authenticate, ensuring continuous access to protected resources.

    token_type stringrequired

    The type of the access token

    expires_in int32

    The lifetime of the access token, in seconds

    refresh_expires_in int32

    The lifetime of the refresh token, in seconds

Loading...