Token Generation

To Generate an access token to AppZen's API gateway for authentication and validation. You need to use this token to access AppZen resources. The token is valid for 60 minutes and AppZen allows the regeneration of the token.

In case of expiration:

  1. You need to refresh the token to regain access.
  2. The scope gained will be the same as the original grant.

Request URI 

POST  https://api.appzen.com/api/v3/oauth2/token 


Body Parameters

Name Type Description Required
client_id String The unique client Id assigned. Yes
client_secret String The unique password assigned. Yes
scope String The scope assigned. 
The scope can be:
expense.report.read expense.report.write
Yes


Sample Request

curl -L -X POST 'https://api.appzen.com/enft/api/v3/oauth2/token' \
-H 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id=0oa6xxxx' \
--data-urlencode 'client_secret=wfiWxxxx' \
--data-urlencode 'scope=expense.report.read expense.report.write'


Sample Response

Success

{
    "token_type": "Bearer",
    "expires_in": 3600,
    "access_token": "eyJrxxxx",
    "scope": "expense.report.read expense.report.write"
}

Failure

The request fails if you do not provide the scope.

{
    "msg": "Internal Server Error: 400 Bad Request: \"{\"error\":\"invalid_scope\",\"error_description\":\"The authorization server resource does not have any configured default scopes, 'scope' must be provided.\"}\"",
    "httpStatus": "INTERNAL_SERVER_ERROR",
    "statusCode": 500
}

 

Response Code

Response Code Description
200 The request is successful.
500 The request failed.


See Also

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.