JSON to user profile key name map

How it works

You can map the fields of the JSON object you return in response to Xsolla Login webhooks to the following user profile properties in the Xsolla system:

  • date of birth (birthday)
  • nickname (nickname)
  • first name (first_name)
  • last name (last_name)
  • gender (gender)
  • user ID on your server (server_custom_id)

Note
Key mapping is only available for the following Xsolla Login webhooks:
The key name map can be used:If you specify a key for the server_custom_id property in the key name map, you can enable account merging by server_custom_id. This allows our system to identify all accounts with the same server_custom_id as belonging to the same user.

Who can use it

Partners who use custom user data storage and want to use that data within Xsolla Login.

How to get it

  1. In your project in Publisher Account, go to the Login section.
  2. Select the login option and go to the User database section.
  3. Go to the Storage section.
  4. Select Custom storage.
  5. Choose the webhook you want to configure the key mapping for:
    • user verification
    • user creation
    • social login
  6. In the Key name map block, enter the field names that should be mapped to the corresponding user profile properties.
  1. Set the Enable user account linking toggle to active to let our system identify all accounts with the same server_custom_id as belonging to the same user (optional).
Note
Account linking by server_custom_id is available only if you specify a key for the server_custom_id property in the key mapping.
  1. Click Save changes.
Note
You don’t need to include all fields in the key mapping.

Key name map usage examples

Passing user data from webhook response into JWT and user profile properties

  1. In response to the user verification webhook, you send the following JSON object (it can contain any set of fields):
Copy
Full screen
Small screen
 1{
 2  "user": {
 3    "player_id": "12345678",
 4    "email": "user@example.com"
 5  },
 6  "user_info": {
 7    "username": "gamer123",
 8    "user_first_name": "John",
 9    "user_last_name": "Doe",
10    "gender": "male",
11    "birthday": "1990-05-15",
12    "country": "US",
13    "language": "en"
14  },
15  "subscription_status": "active",
16  "loyalty_level": "gold"
17}
  1. In Publisher Account, you mapped keys to the nickname and server_custom_id properties.
  1. In response to the Get user details request, you will receive the following JSON:
Copy
Full screen
Small screen
 1{
 2  "birthday": null,
 3  "country": null,
 4  "devices": [
 5    {
 6      "device": null,
 7      "last_used_at": null,
 8      "type": null
 9    },
10    {
11      "device": null,
12      "last_used_at": null,
13      "type": null
14    }
15  ],
16  "email": null,
17  "external_id": null,
18  "first_name": null,
19  "gender": null,
20  "groups": [
21    {
22      "id": 1,
23      "is_default": false,
24      "name": "admin"
25    },
26    {
27      "id": 5,
28      "is_default": false,
29      "name": "user"
30    }
31  ],
32  "id": null,
33  "is_anonymous": false,
34  "last_login": null,
35  "last_name": null,
36  "nickname": "gamer123",
37  "phone": null,
38  "phone_auth": null,
39  "registered": null,
40  "tag": null,
41  "username": null
42}
Note
All values returned in the webhook response will be included in the user’s JWT token if the fields are added to the key name map. For user profile properties that are not present in the system, the response will return null.
As a result, you control which data from your system is included in the Xsolla user profile and becomes available via the API and in the token.

Using key name map and account linking during authentication in Web Shop

  1. The user logs in to Web Shop using their user ID. The User ID is recorded in the server_custom_id field of the JWT.
  2. Web Shop sends a User validation in Web Shop webhook to your server.
  3. Your server responds to the webhook with HTTP 200 if the user exists, or 404 if not.
  4. Web Shop authenticates the user.
  5. The user logs in to Web Shop again using a different method, such as social login.
  6. Web Shop redirects the user to the social network’s login page.
  7. The user logs in to the social network.
  8. The social network returns the user's profile data to Web Shop.
  9. Web Shop sends a webhook to your Social login URL.
  10. Your server identifies the user based on the social network profile data and assigns them the same User ID that was used during the User ID authentication.
  11. Your server responds with a 2xx code and includes a JSON body containing the User ID.
  12. Web Shop saves the user attributes and adds the data from the webhook response to the partner_data field in the JWT.
  13. If the key name map includes a key for server_custom_id and account linking is enabled, Web Shop maps the received user data to the profile properties based on the key name map and links the accounts.
  14. Web Shop authenticates the user into the same account used during the User ID login.
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.

Continue reading

Last updated: July 7, 2025

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!
We couldn't send your feedback
Try again later or contact us at doc_feedback@xsolla.com.