Skip to content
Store Dev
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:

  1. The game client obtains a Game User Access Token via PCSDK3.
  2. The game client uses PCSDK3 to acquire the game user’s token. This token is used to identify the user.
  3. 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.
  4. 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 TypeIssued ByRoleValidity
Game User Access TokenClientAuthenticates the user6 hours (21,600,000ms)
API Access TokenServerAuthenticates the server with STOVE API server720 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


text
POST /auth/v5/server_token
Host:
   https://api.onstove.com (LIVE)    
   https://api.gate8.com (SB)
Content-Type: application/json

Request


NameTypeRequiredDefault ValueExampleDescription
Content-Typeapplication/json----

Parameter

NameTypeRequiredExampleDescription
client_idStringYcom.stove.test.serverRequest from publishing technical representative
client_secretStringYalkjsdf8jsf9n3onf78s9dhfjlk398f9hlksdfuihaoisdhfRequest from publishing technical representative
service_idStringYSGP_EVENTGame ID registered in Partners

Response


Body

NameTypeRequiredExampleDescription
codeintY0Response code
messageStringYsuccessResponse message
response_dataObjectNResponse data
response_data
NameTypeRequiredExampleDescription
access_tokenStringYsljdflksjd239ofmo…API Access Token (AES256 encrypted, ~200 bytes)
token_typeString-bearer-
expires_inIntegerY2591999Expiration time in seconds

Sample


Request


text
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


json
// Success example
{
    "code": 0,
    "message": "success",
    "response_data": {
        "access_token": "-LEn5c7a9L-PaLuOYh8qiyBZOLhTJ6U3oesa1USdf9zhYLwrM6gVEPoedM-QqkT8tskTm0u9-1QhoEdrznCHC_nWHBQ46oVnwBdV9I69bihX8Rzntm3Gv-qTVQrYJG5trLAdcgVInhPGJRYy_t944APpkXtaXWzvfd2tvMsFT08",
        "token_type": "bearer",
        "expires_in": 2591999
    }
}
json
// Failure example
{
    "code": 40105,
    "message": "invalid client"
}

Return Code


HTTP Status codeCodeMessageDescription
2000successSuccess
40140105No client foundinvalid 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


text
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

NameTypeRequiredExampleDescription
AuthorizationStringYBearer {api_access_token}API Access Token
Content-TypeStringYapplication/jsonResource media type

Path Variable

NameTypeExampleDescription
game_idStringSTOVE_GAME_IDGame ID assigned by the platform

Body

NameTypeRequiredExampleDescription
access_tokenStringYUser access token issued via user authentication

Response


Body

NameTypeRequiredExampleDescription
codeIntegerY0Response code
messageStringYsuccessResponse message
valueObjectNResponse data

value

NameTypeRequiredExampleDescription
member_noLongN20005061986STOVE member number
guidLongN200000000397Unique game-specific member ID (created upon Game Service Agreement acceptance)

Sample


Request

text
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

json
// GUID-based game, full member
{
    "code": 0,
    "message": "Success",
    "value": {
        "member_no": 100000001739,
        "guid": 200000000935
    }
}
json
// GUID-based game, guest account
{
    "code": 0,
    "message": "success",
    "value": {
        "guid": 200000000934
    }
}
json
// MemberNo-based game, full member
{
    "code": 0,
    "message": "Success",
    "value": {
        "member_no": 100000002361
    }
}
json
// MemberNo-based game, guest account
{
    "code": 0,
    "message": "Success",
    "value": {
        "member_no": 100000002310 // guest_member_no
    }
}
json
// Mismatched game ID and API Access Token
{
    "code": 41002,
    "message": "Invalid game id"
}

Return Code


HTTP StatusCodeMessageDescription
2000SuccessSuccess
20040000bad requestInvalid parameter (missing or incorrect Authorization header, or invalid request body)
40140101invalid tokenServer access token error (incorrect Authorization header value)
40140103expired tokenServer access token error (expired token)
20041002Invalid game idMismatched game ID between request and server access token
20050000Unknown errorUnknown error

Contact Us


If you have any questions, please contact us on Discord or by email at store.support@smilegate.com.