Xsolla-logo

Auth by custom IDServer-side

post/users/login/server_custom_id

Authenticates a user by a particular custom ID. If the user does not exist, they are created.

SecurityServer
Request
query Parameters
projectId
string <uuid>

Login project ID from Publisher Account. If you do not specify it, shadow Login will be used for the specified publisher_project_id parameter.

Shadow Login ID you do not need to pass to this call.

payload
string

Your custom data. The value of the parameter will be returned in the payload claim of the user JWT. Recommended maximum length less than 500 characters. Note, that this parameter is only available if you use a custom user data storage.

publisher_project_id
integer

Project ID from Publisher Account which you make a request for.

If you specify it, but do not specify project_id parameter, service will be found linked to its project_id. Contact your Customer Success Manager to link project_id to publisher_project_id.

with_logout
string
Default: "0"

Shows whether to deactivate the existing user JWT values and activate the one generated by this call. Can have the following values:

  • 1 to deactivate the existing values and activate a new one,
  • 0 to keep the existing values activated.
Request Body schema: application/json
server_custom_id
required
string <= 256 characters

Custom ID that already exists on your server. Note: It is not the same ID as the Xsolla Login user ID.

Array of objects

User attributes that are updated or created on authduring authentication.

Array
key
required
string <= 256 characters [A-Za-z0-9_]+

Name of attribute that is used to identify user’s attribute. Must be unique per user.

value
required
any
attr_type
required
string

Definition of user’s access level to service attributes:

  • client - A user-editable attribute. The values for this type of attributes are entered by a user or specified according to the in-game logics on the client side. For example, the name and character stats, game difficulty level, etc.
  • server - A read-only attribute. The values for this type of attributes are entered and edited on the server side of your application. We recommend that you use them for configuration of game character stats or user parameters that shouldn’t change regularly. For example, chance to get a bonus, game character key parameters, user categories, etc.
Enum: "client" "server"
permission
required
string

Definition of user’s access level to other users’ attributes.

Enum: "private" "public"
read_only
boolean
object

User social profile.

user_id
required
string

User ID from a social provider.

platform
required
string

Name of the social provider.

object

User profile. This fields describe the user data.

nickname
required
string <= 255 characters

User nickname. The value will be added to the nickname field in the user JWT. Can't be empty. Spaces are allowed, but will be trimmed before and after the nickname. Can be non-unique. You can change the user's nickname value in the Xsolla system using the same method.

Responses
200

OK

400

Bad Request

401

Unauthorized

404

Not Found

422

Unprocessable Entity

429

Too Many Requests

Request samples
application/json
{
  • "attributes": [
    ],
  • "server_custom_id": "1234567890asdfghjkl",
  • "social_profile": {
    },
  • "user_profile": {
    }
}
Response samples
application/json
{
  • "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6IiIsImV4cCI6MTY1MzEyMzk5MCwiZ3JvdXBzIjpbXSwiaWF0IjoxNjUzMDM3NTkwLCJpc3MiOiJodHRwczovL2xvZ2luLnhzb2xsYS5jb20iLCJwdWJsaXNoZXJfaWQiOjMsInNlcnZlcl9jdXN0b21faWQiOiJteS1jdXN0b20taWQtbm90LWxpbmtlZCIsInN1YiI6IjI0MTBkNmMzLWFhZDEtNGY0OS04ODNlLTQ2Y2FkM2ZiMmJjMiIsInR5cGUiOiJzZXJ2ZXJfY3VzdG9tX2lkIiwidXNlcm5hbWUiOm51bGwsInhzb2xsYV9sb2dpbl9hY2Nlc3Nfa2V5IjoiSFhzTVZSWmRtd2tuZXNZMG1pNEpUMVhJUm43bVM4ZU5oc1FxaTU4bmtCayIsInhzb2xsYV9sb2dpbl9wcm9qZWN0X2lkIjoiMTM3NTkyM2ItODdmMy00YTIwLWFjMmItZDBhMjg3MzBlNDIwIn0.D8dFMN5Bmgnpejq1EhZUZQP_D5iFhpO_RXnVyE03qUI"
}