Generate Access Token (Client Credentials)

Generate Access Token (Client Credentials)

Endpoint:
POST /relid/authserver/oauth/token

Description:
Generates an access token for machine-to-machine communication using the client credentials grant type. Typically used when there is no end-user context (e.g., backend services).


šŸ” Authentication

Type: Basic Auth
Header Format: Authorization: Basic <base64(client_id:client_secret)>


šŸ“„ Request Headers

HeaderValue
AuthorizationBasic authentication credentials
Content-Typeapplication/x-www-form-urlencoded
Acceptapplication/json

šŸ“¤ Request Body (Form URL Encoded)

FieldTypeRequiredDescription
grant_typestringYesMust be client_credentials
scopestringYesRequested scope (e.g., all)

šŸ“„ Query Parameters

No query parameters.


šŸ“¬ Response Fields

FieldTypeDescription
access_tokenstringThe generated OAuth2 access token
token_typestringType of token issued (typically Bearer)
expires_innumberExpiry time in seconds
scopestringScopes assigned to this token

šŸ“˜ Example Request (cURL)

curl 'https://auth.relid.com:8006/relid/authserver/oauth/token' \
  -u '<client_id>:<client_secret>' \
  -X POST \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -H 'Accept: application/json' \
  -d 'grant_type=client_credentials&scope=all'

šŸ“˜ Example Response

{
  "access_token": "eyJraWQiOiIzNTg5MDE3MS1hMmIwLTQy...",
  "token_type": "Bearer",
  "expires_in": 299,
  "scope": "all"
}

šŸ“ Notes

  • Ensure your client credentials (client_id and secret) are securely stored.
  • Use this token to authorize other REL-ID API calls by passing it as a Bearer token in the Authorization header.
  • NOTE: Request parameters are expected in the request body only. Any parameters in the URL will be ignored.