How to integrate User Account
How it works
Your users can manage the following data via their account:
- profile picture
- phone
- nickname
- first and last name
- date of birth
- gender
- friend list (available only via API).
You can integrate User Account in one of the following ways:
- With an interface via URL. The User Account interface is localized into 20 languages and adjusts to the screen resolution.
- Without an interface via API. This way you can implement your own interface for managing user data.
Who can use it
Partners who have already integrated Login.
How to get it
Select the way in which you want to integrate User Account and follow the instructions below.
Integration via URL
- Generate a URL for opening User Account.
- Set up User Account opening at the generated URL.
- Set up events processing (optional).
Generate URL
User Account opens athttps://useraccount.xsolla.com/profile
with the parameters described in this table.Parameter | Type | Description |
---|---|---|
locale | string | Query parameter. User Account interface language. Supported languages: English (en) (default), Arabic (ar), Bulgarian (bg), Czech (cs), German (de), Spanish (es), French (fr), Hebrew (he), Italian (it ), Japanese (ja), Korean (ko), Polish (pl), Portuguese (Brazil) (pt), Romanian (ro), Russian (ru), Thai (th), Turkish (tr), Vietnamese (vi), Chinese Simplified (cn), Chinese Traditional (tw). |
token | string | Hash parameter. User JWT. Passed in the URL after successful authentication. Required. |
- http
https://useraccount.xsolla.com/profile?locale=de#token=XXXX
Set up User Account opening at URL
You can set up the opening of User Account at a particular URL in the following ways:
- in an iframe on your website
- in a new tab
IFRAME
Add the following script to the web page where you want to open User Account: <iframe src=“https://useraccount.xsolla.com/profile?locale=ru#token=XXXX">
, where src
is the generated URL.
NEW TAB
Add a URL to the UI object that leads to User Account.
You can use the following script: <a href=“https://useraccount.xsolla.com/profile?locale=ru#token=XXXX">Your account</a>
, where src
is the generated URL.
Set up events processing (optional)
If the User Account opens in an iframe, the parent window gets postMessage events according to user actions in the account.Event name | Description |
---|---|
user-account-close | The user clicks the exit button and closes User Account. |
user-account-loaded | User Account is loaded, but the user data cannot be obtained. |
user-account-page-fetched | User Account and the user data are successfully loaded. |
To process these events, add the addEventListener
method and your script to the website.
Example of an event processing:
- javascript
window.addEventListener('message', (event) => {
if (event.data.command === 'user-account-loaded') {
// your script
}
})
Integration via API calls
To manage user data via API, implement your own interface and allow API requests calling. You will find the detailed description of available API calls and code examples in our documentation.Found a typo or other text error? Select the text and press Ctrl+Enter.