scroll

Token

Token Method

Use the Token API to acquire an Access Token.

POST

https://{Request URI Host}/v1/token

 

Input Variables

When using the Token Method, specify Content-Type: Application/x-www-form-urlencoded for the HTTP Header. For details, see HTTP Header.

Also, specify the Request Body with the following parameters in the URL Encode format.

Required Parameter Definition
app_id Specify the App ID.
secret Specify the Secret.
grant_type Specify the processing type for the Access Token. The following values can be specified.
 oauth_code: Acquires the Access Token.
 refresh_token: Refreshes the Access Token.
code Specify the code acquired by calling the oauth API.
To Refresh the Access Token, specify the value of the Refresh Token acquired at the same time as when the Access Token was acquired.

 

Result Values

When the processing is successfully completed, “200” is returned to the Response Header as the HTTP status, and the value that is described in Output Values can be acquired.

If an error occurs, a value other than 200 is returned. For details, see Authentication and Authorization Error.

 

Output Values

The output value can be acquired in the XML format.

Tag Description
Authentication A root element including authentication information.
 AccessToken An Access Token.
 AccessTokenExpiresIn The expiration period of an Access Token in milliseconds. Normally, an Access Token expires in 30 minutes.
 RefreshToken A Refresh Token.
Use this to update the Access Token.
 RefreshTokenExpiresIn The expiration period of a Refresh Token in milliseconds. Normally, a Refresh Token expires in 2 hours.
 Error This is the code that represents the processing result. For details, see Authentication and Authorization Error.
 Message The message of the processing result.

 

Token Sample

This sample code shown below is not encoded. In the case of an actual Request, encoding/decoding may be necessary depending on the content.

Input Parameter

Specify the parameters for the Request Body in the URL Encode format.

■When acquiring an Access Token

grant_type=oauth_code&app_id=ABC&secret=XYZ&code=aaa

■When refreshing the Access Token

grant_type=refresh_token&app_id=ABC&secret=XYZ&code=aaa

 

Output XML

<Authentication>
 <AccessToken>bbb</AccessToken>
 <AccessTokenExpiresIn>1800000</AccessTokenExpiresIn>
 <RefreshToken>ccc</RefreshToken
 <RefreshTokenExpiresIn>7200000</RefreshTokenExpiresIn>
 <Error>0</Error>
 <Message>Success</Message>
</Authentication>

 

 

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