- Cập nhật lần cuối
Token Validation
This guide explains how to perform secondary verification on the game server for tokens obtained by the game client via the PC SDK.
Introduction
To verify a user’s game access on the game server, follow the steps below:
- The game client obtains a Game User Access Token via PCSDK3.
- The game client uses PCSDK3 to acquire the game user’s token. This token is used to identify the user.
- Token validation via the STOVE server:
- The obtained token is sent in a request to the STOVE server.
- The STOVE server validates the token, checking whether it has been tampered with or expired.
- User verification
- If the STOVE server confirms the token is valid, it verifies the user linked to the token.
- The game server, based on the verified user information from the STOVE server, allows the user to access the game.
This process ensures that the game client can securely verify the user’s identity through the STOVE server before granting game server access. It is a critical security measure to prevent unauthorized access and protect user information.
Sequence Diagram
Access Token Types
| Token Type | Issued By | Role | Validity |
|---|---|---|---|
| Game User Access Token | Client | Authenticates the user | 6 hours (21,600,000ms) |
| API Access Token | Server | Authenticates the server with STOVE API server | 720 hours (30 days) |
1) Game User Access Token
- Issued by calling Base_GetAccessToken() in PCSDK3.
- Two pieces of information are obtained:
- Token (Game User Access Token): A short-lived token (6 hours) that serves as proof of authorization.
- Validity period is 6 hours (21,600,000ms). After expiration, a new token must be issued.
2) API Access Token
- Used for communication between the game server and STOVE Auth Server.
- Must be included in the request header (Authorization) when calling the Token Validation API.
- Validity: 30 days (customizable per client_id).
Recommended renewal approach:
- Call the API Access Token Issue API periodically, or track the expires_in value and renew before expiration.
- If remaining validity is less than 30%, issue a new token.
- The same API Access Token can be shared across multiple servers; previous tokens remain valid until their original expiration.
Note
Server authentication with STOVE Auth Server requires an API Access Token.
Validity: 30 days, after which reissuance is required.
Pre-check: client_id, client_secret
To receive an API Access Token, you need “client_id” and “client_secret”.
These must be issued for the appropriate environment (“Live”, “Sandbox”). Contact your publishing technical representative.
Issue API Access Token
This function issues or retrieves API Access Tokens.
- Token validity configurable (default: 30 days)
- If more than 70% of the validity period has passed, a new token should be issued.
- All issued tokens remain valid until their expiration time.
- This approach optimizes token usage before issuing new ones.
Feature Overview
Provides an Access Token for server authentication when communicating with the STOVE Auth Server.
Basic Information
POST /auth/v5/server_token
Host:
https://api.onstove.com (LIVE)
https://api.gate8.com (SB)
Content-Type: application/json
Request
Header
| Name | Type | Required | Default Value | Example | Description |
|---|---|---|---|---|---|
| Content-Type | application/json | - | - | - | - |
Parameter
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| client_id | String | Y | com.stove.test.server | Request from publishing technical representative |
| client_secret | String | Y | alkjsdf8jsf9n3onf78s9dhfjlk398f9hlksdfuihaoisdhf | Request from publishing technical representative |
| service_id | String | Y | SGP_EVENT | Game ID registered in Partners |
Response
Body
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| code | int | Y | 0 | Response code |
| message | String | Y | success | Response message |
| response_data | Object | N | Response data |
response_data
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| access_token | String | Y | sljdflksjd239ofmo… | API Access Token (AES256 encrypted, ~200 bytes) |
| token_type | String | - | bearer | - |
| expires_in | Integer | Y | 2591999 | Expiration time in seconds |
Sample
Request
curl --location --request POST 'https://api.onstove.com/auth/v5/server_token' \
--header 'Content-Type: application/json' \
--data-raw '{
"client_id": "com.sgp.event.server",
"client_secret": "4tqFNG5ysyBUa6rk-dS4CQ",
"service_id": "SGP_EVENT"
}'
Response
// Success example
{
"code": 0,
"message": "success",
"response_data": {
"access_token": "-LEn5c7a9L-PaLuOYh8qiyBZOLhTJ6U3oesa1USdf9zhYLwrM6gVEPoedM-QqkT8tskTm0u9-1QhoEdrznCHC_nWHBQ46oVnwBdV9I69bihX8Rzntm3Gv-qTVQrYJG5trLAdcgVInhPGJRYy_t944APpkXtaXWzvfd2tvMsFT08",
"token_type": "bearer",
"expires_in": 2591999
}
}
// Failure example
{
"code": 40105,
"message": "invalid client"
}
Return Code
| HTTP Status code | Code | Message | Description |
|---|---|---|---|
| 200 | 0 | success | Success |
| 401 | 40105 | No client found | invalid client |
Game User Access Token Validation API
- The client sends the Game User Access Token to the game server.
- The game server forwards it to the STOVE Auth Server to verify validity.
- The API Access Token must be included in the Authorization header.
- If no API Access Token is present or it is expired, the game server must issue a new one via the API Access Token Issue API.
This process ensures the Game User Access Token is valid, and the API Access Token is renewed if necessary.
Feature Overview
Verifies that the provided Game User Access Token is valid.
Basic Information
POST /member/v3.0/{game_id}/token/verify
Host:
https://api.onstove.com (LIVE)
https://api.gate8.com (SB)
Content-Type: application/json
Request
Header
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| Authorization | String | Y | Bearer {api_access_token} | API Access Token |
| Content-Type | String | Y | application/json | Resource media type |
Path Variable
| Name | Type | Example | Description |
|---|---|---|---|
| game_id | String | STOVE_GAME_ID | Game ID assigned by the platform |
Body
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| access_token | String | Y | User access token issued via user authentication |
Response
Body
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| code | Integer | Y | 0 | Response code |
| message | String | Y | success | Response message |
| value | Object | N | Response data |
value
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| member_no | Long | N | 20005061986 | STOVE member number |
| guid | Long | N | 200000000397 | Unique game-specific member ID (created upon Game Service Agreement acceptance) |
Sample
Request
curl --location --request POST 'https://api.onstove.com/member/v3.0/STOVE_GAME_ID/token/verify' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer Es_ulMUjO7OHmk8WfiPE0-zQAppdPEyye6rRRmrZKkw3sdN38bTYANAsco_0kOHc4EPNPGQHKzV4B080JLd1smLs7YkFwpDOwEKi0aqX_qOa7_LVTl-9jvrWfiYQ-XqiUu7HGScjAWth0_K_CXwsdnvogSf3yE3oRSUvD66obgg' \
--data-raw '{
"access_token": "eyJhbGciOiJIUzI1NiJ9.eyJleHBpcmVfdGltZSI6MTY2MzkyNDQwNzQxNywibWVtYmVyX25vIjoyMDAwNTA2MTk4NiwiYXBwbGljYXRpb25fbm8iOjEwMDAyfQ.lVXx2gL-7keAs42wFDZLS-coqkSUFIAli3Opq4Is34K7ZgnpnneHJx15ofczp3Ep0ogEggRm5WNOungptQqdZy3WbNcMg-0-6MDv2x1QG-MseSAxS1hNZ5TLeDx6emSdSkAsqcp1f6kqnqRX1Hp8oTqPB-UKMQOzx91ox5cbF5KnmaKcf6VZ7tUtaDvCSxS1Ec3xda7iQCBrtgT8wmbppdkcSV2Z7AQbpP8gVnX9-I0_ZHpXroz6nzujdK8DUCJqD7cW5R5nTwMedW5pndqzzQ"
}'
Response
// GUID-based game, full member
{
"code": 0,
"message": "Success",
"value": {
"member_no": 100000001739,
"guid": 200000000935
}
}
// GUID-based game, guest account
{
"code": 0,
"message": "success",
"value": {
"guid": 200000000934
}
}
// MemberNo-based game, full member
{
"code": 0,
"message": "Success",
"value": {
"member_no": 100000002361
}
}
// MemberNo-based game, guest account
{
"code": 0,
"message": "Success",
"value": {
"member_no": 100000002310 // guest_member_no
}
}
// Mismatched game ID and API Access Token
{
"code": 41002,
"message": "Invalid game id"
}
Return Code
| HTTP Status | Code | Message | Description |
|---|---|---|---|
| 200 | 0 | Success | Success |
| 200 | 40000 | bad request | Invalid parameter (missing or incorrect Authorization header, or invalid request body) |
| 401 | 40101 | invalid token | Server access token error (incorrect Authorization header value) |
| 401 | 40103 | expired token | Server access token error (expired token) |
| 200 | 41002 | Invalid game id | Mismatched game ID between request and server access token |
| 200 | 50000 | Unknown error | Unknown error |
Contact Us
If you have any questions, please contact us on Discord or by email at store.support@smilegate.com.