Get Access Token
Get an authorized access to API communications
Overview
Access Token acts as an authentication value that helps Singleview APIs determine that a request is valid and is made by an authorized person.
To generate an access token, a user should process a Get
request to the concerned end-point.
End-point details
End-point details | Method | Grant type | Service validations |
---|---|---|---|
api/v1/oauth/token | GET | The header should include: 1. ClientId 2. ClientSecret 3. Signature | - Valid client credentials - Whitelisted IPs |
The request is posted to the URL https://sandboxapi.onesingleview.com/api/v1/oauth/token in the specified format with all the required details. The system then processes the information to authenticate and a response is generated based on the validity of the details.
Sample request
curl --location 'https://sandboxapi.onesingleview.com/api/v1/auth/token' \
--header 'clientsecret: Enter-Client-Secret' \
--header 'clientid: Enter-Client-Id' \
--header 'SVReferenceID: Enter-SV-Reference-Id' \
--header 'Device: Device-type' \
--header 'DateTimeStamp: YYYY-MM-DDTHH:MM:SS' \
--header 'CompanyId: Enter-Company-Id' \
--header 'BaseCurrency: SAR' \
--header 'Authorization: Bearer <Enter-Token>' \
--header 'Content-Type: application/json' \
--data-raw '{
"Message": {
"OSVAuthRequest": {
"client_id": "Enter_Client_ID",
"client_secret": "Enter_Client_Secret",
"client_name": "Enter_Client_Name"
}
},
"Signature": "Enter_Signature"
}'
Description:
JSON Tag | Description | Data type |
---|---|---|
OSVAuthRequest Mandatory | Authentication request tag | Object |
client_name Mandatory | Name of the client | String |
client_id Mandatory | Unique client identification value | String |
client_secret Mandatory | Unique client secret for authentication | String |
Signature Mandatory | Encrypted string obtained by processing request body with Private Key/Certificate through SHA-256 with RSA Algorithm (Crypto : JCE Sign) | String |
Sample responses
Valid response
✔️ Response occurs if the request is valid and is successfully authenticated and processed
{
"access_token": "iersttsdtddd56gddgdhd789dhsdjfkhfjffk90mckd",
"token_type": "Bearer",
"expires_in": "6000"
}
Description:
JSON Tag | Description | Data type |
---|---|---|
access_token | Access token | String |
token_type | Type of token | String |
expires_in | Time for expiry of the access token | String |
Invalid response
❌ Response occurs if an invalid request format or details or invalid authentication exists
{
status: "FAILURE",
errorCode: "Error_Code",
message: "Invalid_Message"
}
Description:
JSON Tag | Description | Data type |
---|---|---|
status | Status of the response | String |
errorCode | Error Code | String |
message | Response Message | String |
Technical error response
⚠️ Response occurs if a technical error is encountered during the processing of the request
{
status: "TECHERROR",
errorCode: "Error_Code",
message: "Error_Message"
}
Description:
JSON Tag | Description | Data type |
---|---|---|
status | Status of the response | String |
errorCode | Error Code | String |
message | Response Message | String |
Updated about 2 months ago