Create bearer access token

The POST /Auth/connect/token endpoint creates a bearer access token for the provided client credentials.

In this page


Most URLs in the example code use the following values:

Request parameters

Header parameters

content-type

Required The content-type parameter describes the type of the content that you send in the request body. The token endpoint can only accept URL encoded content so you must set the content-type parameter to application/x-www-form-urlencoded.

Example content-type: application/x-www-form-urlencoded

Request body parameters

grant_type

Required All requests to the token endpoint require the grant_type parameter in the body of the request. You must set grant_type to ‘client_credentials’. A grant type of client credentials indicates that you are using OAuth 2.0 for authorization.

Example grant_type=client_credentials

scope

Required The scope parameter identifies the API for which you need a bearer access token and what level of access you will have to that API. Multiple scopes are separated by spaces.

Example scope=stats

client_id

Required The client ID identifies your account to the token endpoint.

Example client_id=abcde

client_secret

Required The secret is like a password that enables you to use the API with your account.

Example client_secret=12345

Path parameters

None.

Query string parameters

None.

Example request

curl -X POST \
  https://emea.newvoicemedia.com/Auth/connect/token \
  -H 'content-type: application/x-www-form-urlencoded' \
  -d 'grant_type=client_credentials&client_id=abcde&client_secret=12345&scope=agents-availability%3Aread'

Responses

Responses contains the new bearer access token.

Successful response

Successful requests return a 200 Success code and the token.

Example response

{
    "access_token": "abcde12345",
    "expires_in": 7200,
    "token_type": "Bearer"
}


Try it out

  

For information, see Trying out Vonage Contact Center APIs.