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:

If main and platform accounts are linked:

  1. User authenticates on a platform.
  2. Xsolla Login server sends a main account token to the user.
  3. 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:
  1. The player enters the game on the game console platform for the first time.
  2. The game UI shows the message that offers to link the platform account to the main account.
  3. The user launches the application and authenticates in the main account.
  4. The application sends the Create code for linking accounts request to the Xsolla Login server.
  5. The application UI shows the user a code for linking the accounts.
  6. The user returns to the console version of the game and enters the code.
  7. The game server sends the Link accounts by code request to the Xsolla Login server.
  8. 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 specify publisher_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 ID
  • client_secret — OAuth 2.0 client secret key
You can use the parameters above for getting a server token.

The algorithm of integrating a cross-platform account is the following:

  1. Implement user authentication for:
    1. Main account
    2. Platform account
  2. Link the accounts:
    1. Getting a code for linking
    2. Linking accounts

Authenticating users in main account

The main account is created in a Login project with a specified main_project_id. You can use both the Login widget and Login API for registration and authentication.

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 via custom ID for another platform.

Authentication via custom ID

To create a platform account, use the Auth by custom ID call on the game server. Pass the following data to this call:

  • publisher_project_id or shadow_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:

  1. The game client sends the authentication request to a game server when the user launches the game.
  2. The game server generates or uses an already existing user custom ID.
  3. The game server sends the Auth by custom ID request to the Xsolla Login server specifying the platform and the user identifier on it (parameters platform and user_id). If the user with a passed custom ID is not found, a new user is created.
  4. The Xsolla Login server sends a token to the game server.

Example of the request:

Copy
Full screen
Small screen

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:

Copy
Full screen
Small screen
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:

  1. Use the Create code for linking accounts call. Pass the user token that you received during authentication in the main account to this call.
  2. Show the received code to the user.

Example of the request:

Copy
Full screen
Small screen

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:

Copy
Full screen
Small screen
HTTP/1.1 200 OK
Content-Type: application/json

{
  "code": "123456"
}

Linking accounts

Use the Link accounts by code call to link a platform account to the main account. Pass the code parameter with the linking code value that the user entered on a console platform to this call.

Example of the request:

Copy
Full screen
Small screen

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:

Copy
Full screen
Small screen
HTTP/1.1 204 No Content
Was this article helpful?
Thank you!
Is there anything we can improve? Message
We’re sorry to hear that
Please explain why this article wasn’t helpful to you. Message
Thank you for your feedback!
We’ll review your message and use it to help us improve your experience.
Last updated: July 31, 2024

Found a typo or other text error? Select the text and press Ctrl+Enter.

Report a problem
We always review our content. Your feedback helps us improve it.
Provide an email so we can follow up
Thank you for your feedback!