Issue User Identification Key
User key issuance is a feature that helps identify users reliably inside the mini app without separate server integration or user consent procedures. The moment a user enters the mini app, that user's mini app provisional member is created.
The function you use varies depending on the mini app type.
Game
getUserKeyForGame
Returns a user identifier key dedicated to game mini apps.
Non-game
getAnonymousKey
Returns a user identifier key dedicated to non-game mini apps.
Both functions return a unique key value (hash) that can identify users without server integration. The returned user identifier is unique to each mini app.
Game mini app
SDK function: getUserKeyForGame
getUserKeyForGameThis is a dedicated API for identifying users in game mini apps. Unlike Toss Login, you can obtain a unique user identifier directly inside the game mini app without a separate authentication screen or server integration.
This function is available only in game category mini appsand the returned user identifier (hash) is unique to each game mini appIt can be used for in-game data storage, ranking management, etc.
Signature
Return value
Promise<GetUserKeyForGameSuccessResponse | 'INVALID\_CATEGORY' | 'ERROR' | undefined>Returns the user key lookup result.
GetUserKeyForGameSuccessResponse: User key lookup succeeded.{ type: 'HASH', hash: string }is returned in this format.hashThe value is a user identifier valid only in the corresponding game mini app.
'INVALID_CATEGORY': Called from a mini app that is not in the game category.'ERROR': An unknown error occurred.undefined: The app version is lower than the minimum supported version.
Example: Get game user identifier
The example below shows the basic flow in a game mini app getUserKeyForGameof calling it to receive and handle a user identifier.
Notes
getUserKeyForGameThis is a login/identification method dedicated to game mini apps.Unlike Toss Login (
appLogin), it can be used without server API integration.We recommend managing game user data (ranking, points, save data, etc.) based on this user key.
Non-game mini app
SDK function: getAnonymousKey
getAnonymousKeyThis is an API for identifying users in non-game mini apps. Like Toss Login, you can obtain a unique user identifier directly inside the mini app without a separate authentication screen or server integration.
This function is available only in non-game category mini appsand the returned user identifier (hash) is unique to each mini appit is.
Signature
Return value
Promise<GetAnonymousKeySuccessResponse | 'INVALID\_CATEGORY' | 'ERROR' | undefined>Returns the user key lookup result.
GetAnonymousKeySuccessResponse: User key lookup succeeded.{ type: 'HASH', hash: string }is returned in this format.hashThe value is a user identifier valid only in the corresponding mini app.
'INVALID_CATEGORY': Called from a mini app that is not in the non-game category.'ERROR': An unknown error occurred.undefined: The SDK version is lower than the minimum supported version.
Example: Get user identifier
The example below shows the basic flow of calling getAnonymousKeyit to receive and handle a user identifier in a non-game mini app.
Notes
getAnonymousKeyis a user identification method dedicated to non-game mini apps.Unlike Toss Login (
appLogin), it can be used without server API integration.We recommend managing user data based on this user key.
Verify identifier key
Used to verify whether the user identifier key is valid.
Basic information
Base URL
https://apps-in-toss-api.toss.im
Server authentication
mTLS (client certificate)
Content-Type
application/json
Method:
POSTEndpoint:
/api-partner/v1/apps-in-toss/users/anon-key/verify
Request headers
Response parameters
success
string
Indicates whether the identifier key is valid. If valid, "true", if invalid, an error response is returned.
Error codes
This is a list of error codes that may occur while using the API. Refer to the response code or message and apply appropriate exception handling logicplease.
401
The user identifier key does not exist or the mapped user cannot be found
Last updated
Was this helpful?