oauth.refreshToken
This interface is implemented on the platform application (APP) server side and called by the SUD OpenPaaS server.
Refresh the access token (refresh_token). After the refresh_token expires, the authorization flow must be repeated.
Call method:
- HTTPS call
HTTPS Call
http
POST {refresh_token_webhook}Request Parameters - Header
| Field | Type | Default | Required | Description |
|---|---|---|---|---|
| timestamp | long | Yes | Millisecond timestamp, follows the common anti-replay rules | |
| nonce | string | Yes | Random string of up to 32 characters, follows the common anti-replay rules | |
| sign | string | Yes | RSA-SHA256 signature, follows the common signing rules | |
| client_secret | string | Yes | Application secret assigned by the platform application (APP) to SUD (application-level authentication secret, passed only in the Header) |
Request Parameters - Body
| Field | Type | Default | Required | Description |
|---|---|---|---|---|
| client_id | string | Yes | Application ID assigned by the platform application (APP) to SUD | |
| grant_type | string | Yes | Fixed value: refresh_token (refresh token mode) | |
| refresh_token | string | Yes | The refresh token obtained from the {access_token_webhook} interface |
Return Value
Object
The returned JSON data packet
| Field | Type | Description |
|---|---|---|
| ret_code | integer | Response code: 0 means success, non-0 means failure |
| ret_msg | string | Response description: returns "success" on success, returns the specific error reason on failure |
| data | object | Business data body (valid data returned only when ret_code=0) |
| data.access_token | string | Access token issued by the platform application (APP); subsequent game/vendor data pull interfaces must carry this token for authentication |
| data.refresh_token | string | Refresh token, used to obtain a new token after the access_token expires (validity is longer than that of the access_token) |
| data.expires_in | integer | access_token validity (unit: seconds), default 7200 seconds (2 hours), subject to the interface return value |
| data.token_type | string | Token type, fixed as Bearer |
| data.scope | string | Authorized scopes (e.g. read write) |
Same as oauth.accessToken: vendor identity comes from the token claim or cp.queryDetail, not from this response.
Valid Values of ret_code
| Value | Description | Minimum Version |
|---|---|---|
| 0 | Request succeeded | |
| 40030 | invalid sign, check the signing algorithm and whether the public/private keys match | |
| 40031 | invalid refresh_token, the refresh token is incorrect or does not belong to this client_id | |
| 42002 | refresh_token expired, the refresh token has expired and the authorization flow must be repeated |
cURL Request
bash
curl -X POST \
{refresh_token_webhook} \
-H 'Content-Type: application/json; charset=utf-8' \
-H 'timestamp: 1668512806000' \
-H 'nonce: abcdef1234567890' \
-H 'sign: YOUR_RSA_SIGNATURE' \
-H 'client_secret: YOUR_CLIENT_SECRET' \
-d '{
"client_id": "YOUR_CLIENT_ID",
"grant_type": "refresh_token",
"refresh_token": "YOUR_REFRESH_TOKEN"
}'Success Response
json
{
"ret_code": 0,
"ret_msg": "success",
"data": {
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "Bearer",
"expires_in": 7200,
"refresh_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
"scope": "read write"
}
}Error Response
json
{
"ret_code": 42002,
"ret_msg": "refresh_token expired"
}