Generate Access Token
Before you continue reading this steps, make sure you already have client_id and client_secret from request access. But if you don’t have the access, you can make request by read instruction from Request Client.
Using HTTP Request to Get Token
[POST] /oauth/token
Parameter
Parameter | Type | Required | Description |
---|---|---|---|
clientID | string | YES | The client ID from requested access |
clientSecret | string | YES | The client Secret from requested access |
grantType | string | YES | Value must be “client_credentials” |
Example cURL Request
curl --location --request GET 'https://api.ruangkerja.id/oauth/token' \
--header 'Content-Type: application/json' \
--data-raw '{
"clientID": "example",
"clientSecret": "example_secret",
"grantType": "client_credentials"
}'
Example Success Response
{
"status": "success",
"message": "success",
"data": {
"accessToken": "7tHvlstBB6nE_oyadVhSCYenJSYWMoQA82wQdUpLmUo.va-Gxa60Qvhi9JbfgNhcSkQWbaQMpyz3KxBnKkcAcRU",
"expiresIn": "43199",
"tokenType": "bearer"
}
}
Response Body Terminology
Parameter | Type | Required | Description |
---|---|---|---|
data.accessToken | string | YES | The access token isuse for authentication & authorization |
data.expiresIn | string | YES | The lifetime in seconds access token |
data.tokenType | string | YES | Token type they are constructed |
Example Error Response
{
"errorCode": 400,
"message": "BAD_REQUEST",
"detail": "Credentials does not match in our records"
}
See also: Error Dictionary.