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
Header | Value |
---|---|
Authorization | Basic authentication credentials |
Content-Type | application/x-www-form-urlencoded |
Accept | application/json |
📤 Request Body (Form URL Encoded)
Field | Type | Required | Description |
---|---|---|---|
grant_type | string | Yes | Must be client_credentials |
scope | string | Yes | Requested scope (e.g., all ) |
📥 Query Parameters
No query parameters.
📬 Response Fields
Field | Type | Description |
---|---|---|
access_token | string | The generated OAuth2 access token |
token_type | string | Type of token issued (typically Bearer) |
expires_in | number | Expiry time in seconds |
scope | string | Scopes 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.
Updated 3 months ago