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

ParameterTypeRequiredDescription
clientIDstringYESThe client ID from requested access
clientSecretstringYESThe client Secret from requested access
grantTypestringYESValue 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

ParameterTypeRequiredDescription
data.accessTokenstringYESThe access token isuse for authentication & authorization
data.expiresInstringYESThe lifetime in seconds access token
data.tokenTypestringYESToken type they are constructed

Example Error Response

{
    "errorCode": 400,
    "message": "BAD_REQUEST",
    "detail": "Credentials does not match in our records"
}

See also: Error Dictionary.