From Bright Pattern Documentation
Jump to: navigation, search
This page contains changes which are not marked for translation.
• 5.19 • 5.2 • 5.3 • 5.8

Request Access Token

This method is used to request an access token.[1]

Request

URL

http[s]://<host>/configapi/v2/oauth/token

Content-Type

application/x-www-form-urlencoded

Parameters

Parameter Required? Description
grant_type Required The value must be client_credentials
client_id Required Login ID
client_secret Required User API secret
scope Required Tenant URL

Example

The following HTTP POST requests an access token for the https://example.com web service. The client_id identifies the user on behalf of the application using the access token.

POST /configapi/v2/oauth/token HTTP/1.1
Host: example.com
Content-Type: application/x-www-form-urlencoded

grant_type=client_credentials&client_id=client-id&client_secret=qkDwDJlDfig2IpeuUZYKH1Wb8q1V0ju6sILxQQqhJ&scope=example.com


Access Token Response

A success response contains a JSON OAuth 2.0 response with the following parameters.

Parameters

Parameter Description
access_token The requested access token.

The calling application can use this token to authenticate to the receiving service.

token_type Indicates the token type value.

The only supported type is Bearer.

For more information about bearer tokens, see The OAuth 2.0 Authorization Framework: Bearer Token Usage (RFC 6750).

expires_in How long the access token is valid (in seconds)

Example of Response

The following example shows a success response to a request for an access token to a web service.

{
"access_token":"eyJhbGciOiJSUzI1NiI5q9Jgt...6HznsvPWy7UP3MINA",
"token_type":"Bearer",
"expires_in":"3599",
}


Use the Access Token to Access the Resource

Now when an access_token is successfully acquired, it is possible to use the token in requests to Web APIs by including it in the Authorization header. RFC 6750 explains how to use bearer tokens in HTTP requests to access protected resources.

Authenticated API request example

GET /data HTTP/1.1
Host: example.com
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbW4t



  1. NGINX configuration is required. For configuration steps, see the Installation Guide for Linux, section NGINX Configuration.


< Previous | Next >