Cross-platform account
How it works
Glossary
You have access to the following Login project types in Publisher Account:
- Standard Login project is a Login project that is used to store main accounts.
- Shadow Login project is a Login project that is used to store platform accounts.
Main account is an account type that is created in a standard Login project and linked to platform accounts. The main account is used to identify the player on different platforms.
Platform account is an account type that is created in a shadow Login project and connected to a definite publishing platform. The platform account can’t be linked to another platform account. Also, you can’t unlink the accounts from a main account.
Publishing platform is a game platform that is used for game distribution (e.g. Steam, PlayStation, Xbox, etc.).
Cross-platform account is an account with platform accounts that link to the main account.
Every user account with games on a definite platform should correspond with a platform account in a shadow Login project. For example, if the user has an account with the games they own on Xbox and PlayStation platforms, the shadow Login project platform accounts should be linked to the corresponding Xbox and PlayStation platform accounts.
Using cross-platform account
Cross-platform account allows you to:
- have one game account on different platforms
- get the list of social account friends from a platform account
If main and platform accounts are linked:
- User authenticates on a platform.
- Xsolla Login server sends a main account token to the user.
- Xsolla Login server authenticates the main account user.
When using the cross-platform account, the user ID in a token will be the same as the main account ID. You can find the user ID in JWT > sub
claim.
Accounts linking flow
If the user has the main account, they can link a platform account to it during authentication on a platform. The flow is the following:- The player enters the game on the game console platform for the first time.
- The game UI shows the message that offers to link the platform account to the main account.
- The user launches the application and authenticates in the main account.
- The application sends the
Create code for linking accounts request to the Xsolla Login server. - The application UI shows the user a code for linking the accounts.
- The user returns to the console version of the game and enters the code.
- The game server sends the
Link accounts by code request to the Xsolla Login server. - The game console shows the confirmation message.
Who can use it
Partners who have already integrated Login and have a publishing platform account.
How to get it
To integrate a cross-platform account, you will need the following parameters from Publisher Account:
main_project_id
— ID of a standard Login project in the UUID format. For example:f6c5011a-715e-4e5e-b7b1-a4812d85b8c8
.shadow_project_id
— ID of a shadow Login project in the UUID format. This project will be used as a Shadow Login project. Create a shadow Login project and specifypublisher_project_id
for it in the Login project settings.shadow_project_id
is the ID of the created project.publisher_project_id
— ID of a project. The parameter is displayed in Project settings > General settings > Project ID.
Send the shadow_project_id
and publisher_project_id
parameters to your Customer Success Manager to get the following OAuth 2.0 client parameters:
client_id
— OAuth 2.0 client IDclient_secret
— OAuth 2.0 client secret key
The algorithm of integrating a cross-platform account is the following:
- Implement user authentication for:
- Link the accounts:
Authenticating users in main account
The main account is created in a Login project with a specifiedmain_project_id
. You can use both the Login widget and Authenticating users in platform account
For user registration and authentication via a platform, choose the method and follow the instruction. You can combine these methods. For example, you can use silent authentication for the Xbox platform and authentication viaAuthentication via custom ID
To create a platform account, use the
publisher_project_id
orshadow_project_id
parameters (the Xsolla Login server returns an error if they are not passed)- a server token
- user platform account information in the
social_profile
parameter
If you use this authentication call, you will not be able to get the list of user friends from different platforms. The list of platforms available for authentication is not limited.
Authentication flow:
- The game client sends the authentication request to a game server when the user launches the game.
- The game server generates or uses an already existing user
custom ID . - The game server sends the
Auth by custom ID request to the Xsolla Login server specifying the platform and the user identifier on it (parametersplatform
anduser_id
). If the user with a passed custom ID is not found, a new user is created. - The Xsolla Login server sends a token to the game server.
Example of the request:
http
- http
- curl
POST https://login.xsolla.com/api/users/login/server_custom_id?publisher_project_id=<publisher_project_id> HTTP/1.1
X-Server-Authorization: <server_token>
Content-Type: application/json
{
"server_custom_id": "secret_value",
"social_profile": {
"platform": "xbox",
"user_id": "123"
}
}
curl --request POST \
--url 'https://login.xsolla.com/api/users/login/server_custom_id?publisher_project_id=publisher_project_id' \
--header 'content-type: application/json' \
--header 'x-server-authorization: server_token' \
--data '{"server_custom_id":"secret_value","social_profile":{"platform":"xbox","user_id":"123"}}'
Example of the response:
- http
HTTP/1.1 200 OK
Content-Type: application/json
{
"token": "<platform_user_token>"
}
Silent authentication
To set up silent authentication, create a shadow Login project and follow the instructions. Use silent authentication methods on the game server to create a platform account.Getting linking code
To get a linking code:
- Use the
Create code for linking accounts call. Pass the user token that you received during authentication in the main account to this call. - Show the received code to the user.
Example of the request:
http
- http
- curl
POST https://login.xsolla.com/api/users/account/code HTTP/1.1
Authorization: Bearer <main_user_token>
curl --request POST \
--url https://login.xsolla.com/api/users/account/code \
--header 'authorization: main_user_token'
Example of the response:
- http
HTTP/1.1 200 OK
Content-Type: application/json
{
"code": "123456"
}
Linking accounts
Use the code
parameter with the linking code value that the user entered on a console platform to this call.
Example of the request:
http
- http
- curl
POST https://login.xsolla.com/api/users/account/link HTTP/1.1
X-Server-Authorization: <server_token>
Content-Type: application/json
{
"code": "123456",
"platform": "xbox",
"user_id": "123",
"publisher_project_id": 44056
}
curl --request POST \
--url https://login.xsolla.com/api/users/account/link \
--header 'content-type: application/json' \
--header 'x-server-authorization: server_token' \
--data '{"code":"123456","platform":"xbox","publisher_project_id":44056,"user_id":"123"}'
Example of the response:
- http
HTTP/1.1 204 No Content
Found a typo or other text error? Select the text and press Ctrl+Enter.