How to transfer user data via launcher installer
How it works
You can transfer user data from the website to the game through the launcher installer, for example:
- Information for tracking promotions or the source of the launcher installer download.
- Data with a limited lifespan. Used for custom authentication in the game and transfer of critical game-related information.
Who can use it
Partners who have already integrated Launcher and Login and connected OAuth 2.0 authentication.
How to get it
To enable transfering of user data, implement the following:
- Retrieval of a one-time password.
- Adding the one-time password to the installer’s name.
- Processing of user data transmitted to the game (optional).
Retrieval of a one-time password
To implement obtaining a one-time password, make a POST request to the URL address https://launcher.xsolla.com/otp
. In the request body, pass a JSON with the following parameters:
tracking_payload
— user data with an unlimited lifespan. The maximum string length is 255 characters.common_payload
— User data with a limited lifespan. These data can be overwritten. The maximum string length is 255 characters.expires_in
— the lifespan of the data passed in thecommon_payload
parameter in the Unix time format, in milliseconds. Required ifcommon_payload
is being transmitted.
- curl
1curl -X POST "https://launcher.xsolla.com/otp?common_payload=<common_payload>" \
2 -H "accept: application/json" \
3 -H "Content-Type: application/json"
tracking_payload
, common_payload
or expires_in
parameters are used, their values cannot be empty.tracking_payload
as a query parameter.- curl
1curl -X POST "https://launcher.xsolla.com/otp?tracking_payload=<tracking_payload>" \
2 -H "accept: application/json" \
3 -H "Content-Type: application/json"
Adding the one-time password to the installer’s name
The received one-time password is a 36-character string in UUID format. Implement adding the one-time password to the installation file name when downloading in the following format: LauncherName_<OTP>.exe
, where <OTP>
is the one-time password.
Retrieval of user data by the game
The launcher passes the data received in the tracking_payload
parameter as the –tracking_payload
command line argument value, as shown in the example below. It also checks for the presence and lifespan of data passed in the common_payload
parameter and passes it as the value of the –xsolla-common-payload
command-line argument, as shown in the example below.
- curl
1game.exe --tracking_payload <tracking_payload> WU9VUiBEQVRBIEhFUkU=
tracking_payload
parameter as the value of the tracking_payload
query parameter, as shown in the example below.1https://web-game-plum.vercel.app/api?locale=en&tracking_payload=<tracking_payload>
The tracking_payload
parameter is passed in UTF-8 encoding. To decode it, implement the execution of the decodeURIComponent(<tracking_payload>)
function on the game side.
Found a typo or other text error? Select the text and press Ctrl+Enter.