Get Authorization token

Retrieves a JWT for authentication.

Uses client_id and client_secret and returns a token.

The token should be used in subsequent API requests. The expires_in field denotes the number of seconds the token will remain valid.

Body·
required
application/json

Request body for obtaining an authorization token.

  • client_id
    Type: string
    required

    Unique identifier for the client application.

  • client_secret
    Type: string
    required

    Secret key for the client application.

  • grant_type
    Type: string
    required

    Must be 'client_credentials' for this flow.

Responses
  • application/json
  • application/json
  • 401

    Authorization failed - Invalid credentials provided.

Request Example for post/auth/oauth2/v1/token
curl https://api.pre.helthjem.no/auth/oauth2/v1/token \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --data '{
  "client_id": "xxx",
  "client_secret": "xxx",
  "grant_type": "client_credentials"
}'
{
  "token": "eyJhbGciOiJIUzI1Ni...",
  "expires_in": 86400,
  "token_type": "Bearer"
}