Xsolla-logo
  • 文档
  • 创建帐户

通过自定义ID进行认证Server-side

post/users/login/server_custom_id

通过特定的自定义ID对用户进行认证。如果用户不存在,则创建用户。

SecurityServer
Request
query Parameters
projectId
string <uuid>

发布商帐户中的登录管理器项目ID。如果不指定,则对指定的publisher_project_id参数使用影子登录管理器

无需向此调用传入影子登录管理器ID。

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

向其提出请求的发布商帐户中的项目ID。

如果指定了该ID,但未指定project_id参数,则会发现服务被关联到其project_id。请联系您的客户成功经理将project_id关联到publisher_project_id

with_logout
string
Default: "0"

显示是否停用现有用户JWT值并激活此调用生成的值。可以是以下值:

  • 1,停用现有值并激活新值;
  • 0,保持现有值的激活状态。
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_]+

用于标识用户属性的属性名称。对于每个用户必须是唯一的。

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

定义用户对其他用户属性的访问级别。

Enum: "private" "public"
read_only
boolean
object

User social profile.

user_id
required
string

来自社交网络提供商的用户ID。

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

确定

400

错误的请求

401

未授权

404

未找到

422

无法处理的实体

429

请求过多

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