POST /v1/authorizations/applyToken
Obtains access tokens. Supports two use cases:
- Authorization Code Exchange: Exchange an
authCodefor anaccessTokenfollowing Mini Program user authentication - Token Refresh: Use a
refreshTokento obtain a newaccessTokenindependently
Request Parameters
The type of token grant being requested.Possible values:
AUTHORIZATION_CODE— Exchange an auth code for tokensREFRESH_TOKEN— Refresh an expired access token
The authorization code received after user authorization.Required when:
grantType is AUTHORIZATION_CODEThe refresh token from a previous token response.Required when:
grantType is REFRESH_TOKENExtended information for wallet and merchant configuration. Should include
customerBelongsTo field mapping to the wallet site name in Mini Program scenarios.Response Parameters
Standard result object with
resultCode, resultStatus, resultMessageToken for accessing user resources within the authorized scope.
Access token expiration time in ISO 8601 format.
Token for obtaining new access tokens when the current one expires.
Refresh token expiration time. After this, the user must re-authorize.
Resource owner identifier.
Extended response information.
Result Codes
| resultStatus | resultCode | Description |
|---|---|---|
S | SUCCESS | Token issued successfully |
F | PARAM_ILLEGAL | Invalid parameters |
F | INVALID_AUTH_CLIENT | Client authentication failed |
F | EXPIRED_CODE | Authorization code no longer valid |
F | USED_REFRESH_TOKEN | Refresh token already consumed |
U | UNKNOWN_EXCEPTION | Unknown error occurred |
U | REQUEST_TRAFFIC_EXCEED_LIMIT | Rate limit exceeded |