Apply for Access Token
Use this interface to request access token with the authorization code retrieved.
Request Headers
Please check API Structure for basics.
Response Headers
Please check API Structure for basics.
Request parameters
grantType string REQUIRED
A string indicates the purpose of this request.
AUTHORIZATION_CODE
: Exchange for an access token.
authCode string
The authorization code for exchanging access token, given in the redirect url as a query parameter.
The authCode is only valid for 10 minutes.
authClientId string
The authClientId indicate which merchant will use to obtain the user information.
Response parameters
result Result REQUIRED
A metadata object indicates the result of the request.
customerId string
The AlipayHK user ID of this authorization process.
accessToken string
An access token to access user information.
accessTokenExpiryTime string
Expiry time of the accessToken
.
More information:
- The value follows the ISO 8601 standard format. For example, "2019-11-27T12:01:01+08:00".
refreshToken string
A refresh token for exchanging a new access token when the original one expires.
refreshTokenExpiryTime string
Expiry time of the refreshToken
.
More information:
- The value follows the ISO 8601 standard format. For example, "2019-11-27T12:01:01+08:00".
Request
Response
Result/Error codes
Code | Value | Message |
---|---|---|
SUCCESS | S | Success |
AUTH_CODE_EXPIRED | F | The authCode has expired, ask user to perform the authorization flow again. |
INVALID_AUTHCODE | F | The authCode is invalid. |
PARAM_ILLEGAL | F | Please check the parameters of request. |
PROCESS_FAIL | F | Business process failure, do not retry. |
USER_NOT_EXIST | F | No user was found with this authCode. |
USER_STATUS_ABNORMAL | F | The status of user with authCode is abnormal. |
UNKNOWN_EXCEPTION | U | API failed due to unknown reason, please check with support. |