Obtaining the Token
Purpose
To retrieve an access token which represents the authorization to your application to access the other API services.
Process summary
On this page you will find the following
Â
- 1 Purpose
- 1.1 Process summary
- 2 Initial token retrieval
- 2.1 Client Credentials
- 2.1.1 Response
- 2.1.1.1 Response message format
- 2.1.1 Response
- 2.2 Authorization Code
- 2.3 Password Grant (deprecated)
- 2.3.1 Response
- 2.3.1.1 Response message format
- 2.3.1 Response
- 2.1 Client Credentials
- 3 Subsequent token refreshes
- 3.1 Response
- 3.1.1 Response message format
- 3.1 Response
Â
To download the vision diagram on the right you can click below
Â
Initial token retrieval
When integrating we’ll suggest the grant_type to use, in most cases this will be client_credentials. This returns an access_token ready to be used, and also a refresh_token which you can use to refresh the access_token when it expires.
Client Credentials
POST URL: <address>/token
Parameter (x-www-form-urlencoded)
Parameter | Description | Example |
---|---|---|
grant_type | Set to 'client_credentials' | client_credentials |
client_id | The client_id given to you to identify your application, You must ensure that you base64 encode this if it hasn’t been already. (It generally has == at the end when encoded) | assdasd== |
client_secret | The client_secret given to you to identify your application, You must ensure that you base64 encode this if it hasn’t been already. (It generally has == at the end when encoded) | asfsafsa121== |
Response
Response message format
{
"access_token": "sfOlnPVA",
"token_type": "bearer",
"expires_in": 86399,
"refresh_token": "W8mhOR9FlWooICUhToEZw7x6aBVURDFar1g",
"client_id": "AKJSLABJ",
"user_id": "1",
"InternalServiceAccessOnly": "False",
".issued": "Wed, 10 Jun 2020 08:44:41 GMT",
".expires": "Thu, 11 Jun 2020 08:44:41 GMT"
}
Key details:
Key | Description | Example |
---|---|---|
access_token | Your access token Use this to access the other services | OrDyWqNxG-kEHZVfDXoFe2iwRQAf.... |
expires_in | Lifetime of the token in seconds | 14400 |
refresh_token | Your refresh token Use this to refresh your access token after it expires | _p4Jeu1PP9_H6bkeZk9Ew6MdXtR |
Â
Subsequent token refreshes
POST URL: <address>/token
Parameter (x-www-form-urlencoded)
Parameter | Description | Example |
---|---|---|
grant_type | Set to 'refresh_token' | refresh_token |
refresh_token | The refresh_token generated for you in the access_token request | _p4Jeu1PP9_H6bkeZk9Ew6MdXtR |
client_id | The client_id given to you to identify your application | b3187e8b1faacfef38641c072b2d8864 |
Response
Response message format
Key details:
Key | Description | example |
---|---|---|
access_token | Your new access token Use this to access the other services | OrDyWqNxG-kEHZVfDXoFe2iwRQAf.... |
Copyright Ontech Solutions 2017-2024. All rights reserved, no part may be replicated or distributed without the express permission of the owner.