Cross-Platform Account

How It Works

Glossary

You have access to the following Login project types in Publisher Account:

  1. Standard Login project is a Login project that is used to store main accounts.
  2. 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 a 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 Account 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 the 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 method on the game server. Pass the following data to this method:

  • 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 method, 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
POST https://login.xsolla.com/api/users/login/server_custom_id?publisher_project_id=<publisher_project_id> HTTP/1.1

Host:
login.xsolla.com

Headers:
X-Server-Authorization: <server_token>
Content-Type: application/json

Body:
{
  "server_custom_id": "secret_value",
  "social_profile": {
    "platform": "xbox",
    "user_id": "123"
  }
}

Example of the response:

Copy
Full screen
Small screen
{
  "token": "<platform_user_token>"
}

Silent Authentication

Follow the Silent Authentication recipe to set it up. Use silent authentication methods on the game server to create a platform account.

If you use silent authentication methods, you will be able to get the list of user friends from different platforms. The list of platforms available for silent authentication is in the recipe.

Getting Linking Code

To get a linking code:

  1. Use the Create Code for Linking Accounts method. Pass the user token that you received during authentication in the main account to this method.
  2. Show the received code to the user.

Example of the request:

Copy
Full screen
Small screen
POST https://login.xsolla.com/api/users/account/code HTTP/1.1

Host:
login.xsolla.com

Headers:
Authorization: Bearer <main_user_token>

Example of the response:

Copy
Full screen
Small screen
{
  "code": "123456"
}

Linking Accounts

Use the Link Accounts by Code method 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 method.

Example of the request:

Copy
Full screen
Small screen
POST https://login.xsolla.com/api/users/account/link HTTP/1.1

Host:
login.xsolla.com

Headers:
X-Server-Authorization: <server_token>
Content-Type: application/json

Body:
{
  "code": "123456",
  "platform": "xbox",
  "user_id": "123",
  "publisher_project_id": 44056
}

Example of the response:

Copy
Full screen
Small screen
HTTP/1.1 204 No Content