This document describes how to issue tokens used for server API authorization, which is required to communicate with the Stove Platform API server.
기능 소개
To use the API, an authentication process is required, and an API AccessToken (hereinafter referred to as API AccessToken) is used.API AccessToken can be generated through the API AccessToken Issuance API.API AccessToken is used in the form of authorization: {API accessToken} in the API Header.
Prepare in advance
항목 | 설명 |
Stove Studio product page launched | 스토브 스튜디오 가입후, 상품페이지를 오픈합니다. |
API AccessToken Issuance Key | Request STOVE Support to issue a key. If issued, "client_id", "client_secret", "service_id" will be passed. |
To request a key to generate an API access token, please contact store.support@smilegate.com.
Guidance
•
The Server Access Token has a validity period of 30 days and must be generated (reissued) after the validity period.
◦
The validity period can be managed (changed) per client_id.
◦
The default policy is 30 days, if you need to change it, please contact us.
The server managing the server access token must periodically call the API AccessToken issuance API to renew the server access token, or store expires_in to update the issuance API before expiration.You must implement a way to periodically renew and use the server access token.
•
When calling the API AccessToken Issuance API, if the existing issued token has more than 30% of its validity remaining, it will pass the existing server token, and if less than 3% remains, it will issue a new server token.
◦
The same server token can be used on multiple servers, and we expect that each server will have different API call cycles, so the existing server token can be used up to its existing validity period even after a new server token is issued.
◦
Since the same server token can be used on all servers based on client_id, it is recommended to use the instance_id parameter for server-specific token usage/management.
Basic information
POST /auth/v5/server_token
Host:
https://api.onstove.com (Live)
https://api.gate8.com (Sandbox)
Content-Type: application/json
Plain Text
복사
Request
Header
Name | Type | Required | Example | Description |
Content-Type | application/json | Y | . | 리소스 media type |
caller-id | String | Y | STOVE_GAME_SERVER | API caller information- {service_id}_HOME(Official Homepage)- {service_id}_SERVER(서버) |
Body
Name | Type | Required | Example | Description |
client_id | String | Y | com.stove.test.server | |
client_secret | String | Y | alkjsdf8jsf9n3onf78s9dhfjlk398f9hlksdfuihaoisdhf | |
service_id | String | Y | STOVE_TEST | Game ID |
instance_id | String | N | server_01 | If not present, the same token will be descended by client_id, if present, it will be descended by client_id+instance_id |
Response
Body
Name | Type | Required | Example | Description |
code | Integer | Y | 0 | Return code (0: success) |
message | String | Y | Return message | |
response_data | String | N | API AccessToken |
Response_data properties
Name | Type | Required | Example | Description |
access_token | String | Y | sljdflksj39ofmosdg98yfgoudfgfljsfoj3498klfbsdfgs98dfug;lkj== | API AccessToken encrypted with AES256 |
expires_in | Integer | Y | 2591999 | Expiration time in seconds |
server | String | Y | Request information |
Server properties
Name | Type | Required | Example | Description |
client_id | String | Y | com.stove.test.server | client_id |
service_id | String | Y | STOVE_TEST | service_id |
instance_id | String | N | server_01 | instance_id |
Return code
Success
Return Code | Message | HTTP Status Code |
0 | Successful | 200 ok |
Fail
Return Code | Message | HTTP Status Code | Description |
40105 | No client found | 401 unauthorized | invalid client |
Sample
Request
curl --location --request POST 'https://api.onstove.com/auth/v5/server_token' \
--header 'Content-Type: application/json' \
--header 'caller-id: STOVE_GAME_SERVER' \
--data-raw '{
"client_id": "com.sgp.event.server",
"client_secret": "4tqFNG5ysyBUa6rk-dS4CQ",
"service_id": "SGP_EVENT",
"instance_id": "server001"
}'
Plain Text
복사
Response
// Success{
"code": 0,
"message": "success",
"response_data": {
"access_token": "-LEn5c7a9L-PaLuOYh8qiyBZOLhTJ6U3oesa1USdf9zhYLwrM6gVEPoedM-QqkT8tskTm0u9-1QhoEdrznCHC_nWHBQ46oVnwBdV9I69bihX8Rzntm3Gv-qTVQrYJG5trLAdcgVInhPGJRYy_t944APpkXtaXWzvfd2tvMsFT08",
"token_type": "bearer",
"expires_in": 2591999,
"server": {
"instance_id": "server001",
"service_id": "SGP_EVENT",
"client_id": "com.sgp.event.server"
}
}
}
// Failure{
"code": 40105,
"message": "invalid client"
}
JSON
복사