Toss Login migration
Toss Login(userKey) a mini app that uses User identification key(hash) explains how to switch to using hash.
Following this document, you can gradually map users currently using Toss Login to user identification keys, and once all users have been migrated, you can completely remove the Toss Login dependency.
When should you use this guide?
Existing Toss Login
userKeyare using it for user identification.In the future, user identification key
hashI want to use the value as the standard identifier.
Key concepts
User identification key hash:
getUserKeyForGame()A game-specific unique identifier issued by callingToss Login userKey: Existing Toss Login-based user identifier
Mapping: the same user's
userKeyandhashvalues linked 1:1
Overall migration flow
On the client,
getUserKeyForGame()obtain the user identification keyhashvalue.getIsTossLoginIntegratedService()to check whether Toss Login is integrated.Check the mapping status on the partner company's server.
If it is not mapped,
appLogin()proceed with Toss Login throughhashsend the value to the server.On the server, Toss Login
userKeyand user identification keyhashsave the value in the mapping table.After that,
hashyou can identify users with the value alone. Once all users are mapped, remove the Toss Login dependency.
APIs that require pre-implementation
The partner company must implement the following two APIs directly. These APIs are not provided by Apps in Toss; please refer to the examples below and develop them yourself on the partner company's server.
Check mapping status
POST /api/auth/migration/statusReq:
{ hash: string }Res:
{ isMapped: boolean }
Create mapping
POST /api/auth/migration/linkReq:
{ hash: string; authorizationCode: string; referrer?: string }Res:
{ success: true }
Client implementation steps
1. Import SDK
2. Issue game hash value
3. Check whether Toss Login is integrated
For detailed API specifications, see the getIsTossLoginIntegratedService section below.
4. Check mapping status and map on partner company's server
5. Use user identification key hash
Now user identification can be based on user identification key hashvalue. Toss Login userKey instead, getUserKeyForGame() the user identification key issued with hashplease use the value as the user identifier on both server and client.
Full example code
Check whether Toss Login is integrated
SDK function: getIsTossLoginIntegratedService
getIsTossLoginIntegratedServiceis an API that checks whether the current user is integrated with Toss Login.
This function is mainly used in the migration process from Toss Login to issuing user identification keysand can be used to branch login flows or data migration handling depending on whether the user is an existing Toss Login user.
Signature
Promise<boolean>
If the current service is integrated with Toss Login true, otherwise falseis returned.
Notes
This API is only meaningful in mini apps that use (or used) Toss Login.
Calling it in a mini app that never uses Toss Login may cause the exception below.
Example: Checking whether Toss Login is integrated
The example below shows a basic flow that checks whether the user is a Toss Login integrated user, then performs different actions depending on the status.
When is it useful?
In a Toss Login-based service switching (migration) to a user identification key when
distinguishing existing users from new users data migration/compensation handlingwhen needed
depending on whether Toss Login is integrated providing different UXwhen needed
Notes
getIsTossLoginIntegratedServiceis a migration support API.For authentication/login features, please refer to the following.
Toss Login