alipay.intl.oauth.auth.applyToken (Macao)
The API is used by the merchant to get access token from the authSite.
Request
Service address
Environment | URL |
Production | https://open.alipaymo.com/api/alipay/intl/oauth/auth/applyToken.htm |
Request Header
Name | Description |
version | API version Example:2.0.0 |
function string | API interface Example:alipay.intl.oauth.auth.applyToken |
clientId string(32) | Client ID Example:5C5XSR3USG0CQJ05 |
reqTime datetime | Request time Example:2019-12-24T23:18:42-08:00 |
reqMsgId string(64) | Request message ID Example:8887ef5096774cb9a8aa8a4e07acf714 |
Request Body
Name | Description |
grantType | Grant type. The accessToken could be granted by authCode or refreshToken. Example:AUTHORIZATION_CODE |
authMerchantId string(64) | Auth merchant ID. The auth merchant can be authorized by the user to access user resources. Example:218820000000023 |
authSite | The site which can authorize the user. Example:ALIPAY_MO |
authCode string(64) | An authorization code which the caller can used to obtain an access token. Example:4b203fe6c11548bcabd8da5bb087a83b |
Synchronous Response
Response Header
Name | Description |
version | API version Example:2.0.0 |
function string | API interface Example:alipay.intl.oauth.auth.applyToken |
clientId string(32) | Client ID Example:5C5XSR3USG0CQJ05 |
reqTime datetime | Request time Example:2019-12-24T23:18:42-08:00 |
reqMsgId string(64) | Request message ID Example:8887ef5096774cb9a8aa8a4e07acf714 |
Response body
Name | Description |
resultInfo <resultInfo> | Result info Example: { "resultStatus": "S", "resultCodeId": "00000000", "resultCode":"SUCCESS", "resultMsg": "result message" } |
accessTokenInfo <accessTokenInfo> | The detailed accessToken information. Example: { "accessToken": "publicpBa869cad0990e4e17a57ecf7c5469a4b2", "expiresIn": "2001-07-04T12:08:56+05:30", "refreshToken":"201510BB0c409dd5758b4d939d4008a525463X62", "reExpiresIn": "2001-07-04T12:08:56+05:30", "tokenStatus":"ACTIVE" } |
authSiteUserId string(64) | The parameter identifies the unique user id within the authSite. Recommend to provide. Example: 2182123456123456 |
Request Sample
{
"request":{
"head": {
"version": "2.0.0",
"function": "alipay.intl.oauth.auth.applyToken",
"clientId": "5C5XSR3USG0CQJ05",
"reqTime": "2020-08-11T18:38:52+08:00",
"reqMsgId": "e0a15879bad24193b3452f1b4110620f"
},
"body": {
"authCode": "0iU9JGnemDnVHE2OPYwxBqo2zCccz349",
"authMerchantId": "2182400000001037",
"authSite": "ALIPAY_MO",
"grantType": "AUTHORIZATION_CODE"
}
},
"signature":"signature string"
}
Response Sample
{
"response":{
"body": {
"accessTokenInfo": {
"accessToken": "xoC00000DEq2TbeMG3yHKL11111AL7Z7vHjPhu6A6O000349",
"expiresIn": "2021-08-11T03:38:52-07:00",
"reExpiresIn": "2037-12-31T16:00:20-08:00",
"refreshToken": "bxj2LImd44444K9VoLtVEY33333skHdL4sfrmyyCRG001349",
"tokenStatus": "ACTIVE"
},
"authSiteUserId": "2182123456123456",
"resultInfo": {
"resultCode": "SUCCESS",
"resultCodeId": "00000000",
"resultMsg": "execute success",
"resultStatus": "S"
}
},
"head": {
"clientId": "5C5XSR3USG0CQJ05",
"function": "alipay.intl.oauth.auth.applyToken",
"reqMsgId": "e0a15879bad24193b3452f1b4110620f",
"respTime": "2020-08-11T03:38:52-07:00",
"version": "2.0.0"
}
},
"signature":"signature string"
}
Result Code
No. | ResultCodeId | ResultCode | ResultStatus | Remarks |
1 | 00000011 | RISK_REJECT | F | Risk reject |
2 | 12002005 | USER_NOT_EXIST | F | User does not exist |
3 | 12002006 | USER_STATUS_ABNORMAL | F | User status is not normal. |
4 | 12002027 | OTP_VERIFY_TIMES_EXCEED_LIMIT | F | Verify code failed too many times, user must get a new code. |
5 | 12002026 | OTP_VERIFY_UNMATCHED | F | Verify code invalid |
6 | 12014174 | AUTH_CODE_INVALID | F | authCode is invalid |
7 | 12014175 | REFRESH_TOKEN_INVALID | F | Refresh token is invalid |
No. | ResultCodeId | ResultCode | ResultStatus | Remarks |
1 | 00000000 | SUCCESS | S | Success |
2 | 00000019 | PROCESS_FAIL | F | General business failure. No retry. |
3 | 00000901 | UNKNOWN_EXCEPTION | U | API failed due to unknown reason. |
4 | 00000004 | PARAM_ILLEGAL | F | Illegal parameters. For example, non-numeric input, invalid date. |
5 | 00000007 | INVALID_SIGNATURE | F | Signature is invalid. |
6 | 00000008 | KEY_NO_FOUND | F | Key is not found. |
7 | 00000013 | NO_INTERFACE_DEF | F | API is not defined |
8 | 00000014 | API_IS_INVALID | F | API is invalid (or not active) |
9 | 00000016 | OAUTH_FAILED | F | oAuth authentication failed |
10 | 00000021 | ACCESS_DENIED | F | Access denied |
11 | 12014152 | CLIENT_FORBIDDEN_ACCESS_API | F | Client is not authorized to use this API |
12 | 12014155 | UNKNOWN_CLIENT | F | Unknown client |
13 | 12014156 | INVALID_CLIENT_STATUS | F | Invalid client status |
14 | 00000024 | REQUEST_TRAFFIC_EXCEED_LIMIT | F | Request traffic exceed limit. |