Skip to main content

Access Control clients authentication

OAuth2: How to obtain the access token for Access Control API

You can get the Oauth token for Access Control API in the following way:

  • The Url where to do the request for pre environment is https://oauth2-pre.oneboxtickets.net/oauth/token . See environments

  • Next, we are going to prepare the required headers.

    • Content-Type: application/x-www-form-urlencoded
  • Finally, we indicate the request parameters to obtain the authorization's token:

    • grant_type: client_credentials
    • client_id: access-control-client
    • client_secret: [api_key_provided]

For example with curl:

curl --location --request POST 'https://oauth2-pre.oneboxtickets.net/oauth/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'client_id=access-control-client' \
--data-urlencode 'client_secret=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'

If all it's correct, OAuth returns a structure as this:

{
"access_token": "xxxxxxxxxxxxxxxxx",
"token_type": "bearer",
"refresh_token": "xxxxxxxxxxxxxxx",
"expires_in": 43199,
"scope": "api-channels-all api-gateway",
"authInfo": "xxxxxxxxxxxxxx",
"jti": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
access_token is our token with a limit of 12 hours of expire. Congralutions!.