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 detailsMethodGrant typeService validations
api/v1/oauth/tokenGETThe 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 TagDescriptionData type
OSVAuthRequest
Mandatory
Authentication request tagObject
client_name
Mandatory
Name of the clientString
client_id
Mandatory
Unique client identification valueString
client_secret
Mandatory
Unique client secret for authenticationString
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 TagDescriptionData type
access_tokenAccess tokenString
token_typeType of tokenString
expires_inTime for expiry of the access tokenString

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 TagDescriptionData type
statusStatus of the responseString
errorCodeError CodeString
messageResponse MessageString

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 TagDescriptionData type
statusStatus of the responseString
errorCodeError CodeString
messageResponse MessageString