Skip to main content
POST /v1/authorizations/applyToken Obtains access tokens. Supports two use cases:
  1. Authorization Code Exchange: Exchange an authCode for an accessToken following Mini Program user authentication
  2. Token Refresh: Use a refreshToken to obtain a new accessToken independently

Request Parameters

grantType
string
required
The type of token grant being requested.Possible values:
  • AUTHORIZATION_CODE — Exchange an auth code for tokens
  • REFRESH_TOKEN — Refresh an expired access token
authCode
string
The authorization code received after user authorization.Required when: grantType is AUTHORIZATION_CODE
refreshToken
string
The refresh token from a previous token response.Required when: grantType is REFRESH_TOKEN
extendInfo
string
Extended information for wallet and merchant configuration. Should include customerBelongsTo field mapping to the wallet site name in Mini Program scenarios.

Response Parameters

result
object
required
Standard result object with resultCode, resultStatus, resultMessage
accessToken
string
Token for accessing user resources within the authorized scope.
accessTokenExpiryTime
string
Access token expiration time in ISO 8601 format.
refreshToken
string
Token for obtaining new access tokens when the current one expires.
refreshTokenExpiryTime
string
Refresh token expiration time. After this, the user must re-authorize.
customerId
string
Resource owner identifier.
extendInfo
string
Extended response information.

Result Codes

resultStatusresultCodeDescription
SSUCCESSToken issued successfully
FPARAM_ILLEGALInvalid parameters
FINVALID_AUTH_CLIENTClient authentication failed
FEXPIRED_CODEAuthorization code no longer valid
FUSED_REFRESH_TOKENRefresh token already consumed
UUNKNOWN_EXCEPTIONUnknown error occurred
UREQUEST_TRAFFIC_EXCEED_LIMITRate limit exceeded