https://login.xsolla.com/api
Esta sección describe las llamadas API para trabajar con Login. Establezca su proyecto de Login en Cuenta del editor antes de enviar solicitudes.
The full list of IP addresses that login.xsolla.com may use:
Puede acceder a los siguientes tipos de proyectos de Login en Cuenta del editor:
Para obtener más información al respecto, consulte el artículo Cuenta multiplataforma.
Son las restricciones aplicadas por la API de Xsolla a la frecuencia de acceso por parte de un usuario en un plazo definido.
Es un proyecto de Login que se utiliza para almacenar las cuentas principales.
Es un proyecto de Login que se utiliza para almacenar las cuentas de plataforma.
Es un tipo de cuenta que se crea en un proyecto de Login estándar y se vincula a cuentas de plataforma. La cuenta principal se utiliza para identificar al jugador en las diferentes plataformas.
Es un tipo de cuenta que se crea en un proyecto de Login concurrente y se conecta a una plataforma de publicación definida. La cuenta de plataforma no puede vincularse a otra cuenta de plataforma. Tampoco puede desvincularse de una cuenta principal.
Es una plataforma de juegos que se utiliza para la distribución de juegos (p. ej., Steam, PlayStation, Xbox, etc.).
Login API admite los siguientes tipos de token:
Puede determinar si una llamada API es del lado del cliente o del lado del servidor por el esquema de autenticación:
Authorization
header: Bearer <user_JWT>
header,
where <user_JWT>
— is the user token.X-SERVER-AUTHORIZATION: <server_JWT>
, where
<server_JWT>
— is the server token.Para obtener el token, envíe una de las siguientes solicitudes:
Tras la autenticación mediante JWT, el usuario es redirigido a la URL de
devolución de llamada con un token en un parámetro de consulta: <Callback URL>?token=<User token (JWT)>
.
Tras la aunticación basada en el protocolo OAuth 2.0, envíe la solicitud
Generate JWT
al servidor de Xsolla Login para cambiar el parámetro code
recibido por un
token de usuario (access_token
).
Para obtener un token de servidor:
En el back-end de su aplicación, implemente un método para obtener el JWT de servidor utilizando la llamada Generate JWT API. La solicitud debe contener los siguientes parámetros:
grant_type
es el tipo de obtención del JWT, transmita el valor
client_credentials
.client_secret
es la clave secreta que se recibe cuando establece el cliente
de OAuth 2.0 del servidor.client_id
es el ID de cliente recibido al establecer el cliente OAuth 2.0 del
servidor.Para evitar sobrecargas del sistema de Xsolla y protegerlo de ráfagas
repentinas de tráfico entrante, Xsolla limita el número de solicitudes
recibidas por la API de Xsolla durante un periodo especificado. Si se excede el
límite, la API de Xsolla devuelve una respuesta HTTP con el código de estado
429
.
Rate limits vary by method, IP-address, authentication scheme, and other factors.
Rate limits for server-side methods are applied to methods with server-side
authentication — methods that are called with the X-SERVER-AUTHORIZATION:
<server_JWT>
header, where <server_JWT>
is the server
token.
Rate limits for client-side methods are applied to methods without
authentication or with client-side authentication — methods that are called
with the Authorization: Bearer <user_JWT>
header, where
<user_JWT>
is the user token.
Example of a method with server-side authentication: Example of a method with client-side authentication:
Los límites de frecuencia para los métodos del lado del cliente no cambian y son necesarios para impedir ataques de fuerza bruta. La frecuencia máxima de solicitudes para los métodos del lado del servidor es mayor que para los métodos del lado del cliente. Puede consultar las recomendaciones sobre cómo gestionar los límites de frecuencia en la documentación.
Cada token tiene un formato de JWT y contiene una información precisa en una carga útil.
El JWT de usuario es un token recibido como resultado de una autenticación o registro. La carga útil de un token contiene información sobre el usuario y la llamada de autenticación.
Obtener un token de usuario mediante el protocolo OAuth 2.0 requiere un cliente
de OAuth 2.0. El token de usuario se transmite en el encabezado Authorization: Bearer <JWT>
.
Un token contendrá las notificaciones principales tras la autenticación o la confirmación de la dirección de correo electrónico. La presencia de estas notificaciones no depende de la base de datos de usuarios ni de la llamada de autenticación.
Notificación | Tipo | Obligatoria | Descripción |
exp |
Marca de tiempo de Unix | Sí | Fecha y hora de expiración del token. El tiempo de expiración por defecto es de 24 horas. Puede cambiar el tiempo de expiración para cada proyecto de Login. |
iss |
string | Sí | Servicio que firmó el token: https://login.xsolla.com . |
iat |
Marca de tiempo de Unix | Sí | Fecha y hora de entrega del token. |
sub |
string (cadena) (UUID) | Sí | ID de usuario escrito en el lado del servidor de Xsolla Login. |
groups |
matriz | Sí |
La lista de grupos a los que pertenece el usuario. Cada grupo se escribe con el siguiente formato:
Solo puede haber un grupo por defecto. Este grupo incluye inicialmente a todos los usuarios antes de que se distribuyan en diferentes grupos. |
xsolla_login_project_id |
string (cadena) (UUID) | Sí | ID del proyecto de Login. |
type |
string |
Opciones de autenticación:
Solo puede haber un grupo por defecto. Este grupo incluye inicialmente a todos los usuarios antes de que se distribuyan en diferentes grupos. |
|
avatar |
string | URL del avatar del usuario. | |
username |
string | Nombre de usuario. | |
publisher_id |
integer | ID de un vendedor propietario de un proyecto de Login. | |
email |
string | Dirección de correo electrónico del usuario. | |
payload |
string | Información adicional que se transmite en el parámetro de carga útil durante la autenticación. | |
promo_email_agreement |
boolean |
Puede tener uno de los siguientes valores:
true por defecto.
Para añadir la función al formulario de registro del widget de Login :
|
|
connection_information |
string | Muestra si el usuario ha confirmado o no su fecha de nacimiento. La confirmación se realiza a través del servicio okname. |
Notificaciones contenidas en el token tras la autenticación si utiliza el almacenamiento de PlayFab.
Notificación | Tipo | Obligatoria | Descripción |
external_account_id |
string | Sí | ID de usuario de PlayFab. |
session_ticket |
string | Sí |
Un parámetro SessionTicket recibido durante una solicitud de autenticación o solicitudes a la PlayFab API. Un token contiene la notificación si autentica a los usuarios mediante el protocolo OAuth 2.0 y transmite el valor |
entity_token |
string | Sí | Un parámetro EntityToken.EntityToken. |
entity_type |
string | Sí | Un parámetro EntityToken.Entity.Type. Solo puede tener el valor title_player_account . |
entity_id |
string | Sí | Un parámetro EntityToken.Entity.Id. |
Notificaciones contenidas en el token tras la autenticación si utiliza el almacenamiento personalizado.
Notificación | Tipo | Obligatoria | Descripción |
provider |
string | Sí | Nombre de la red social utilizada para la autenticación. Si el usuario se autentica mediante nombre de usuario y contraseña, la notificación tiene el valor xsolla . |
external_account_id |
string | ID de usuario en el lado de su servidor. | |
partner_data |
Data of any type returned by your server in the response body during authentication. To enable the transmission of this claim, contact your Customer Success Manager or email to csm@xsolla.com | ||
social_access_token |
Access token of the social network through which the user was authenticated. To enable the transmission of this claim, contact your Customer Success Manager or email to csm@xsolla.com. |
Notificaciones contenidas en el token tras la autenticación OAuth 2.0.
Notificación | Tipo | Obligatoria | Descripción |
jti |
string | Sí | ID de token único. |
Notificación que contiene el token tras la autenticación mediante un número de teléfono.
Notificación | Tipo | Obligatoria | Descripción |
phone_number |
string | Sí | Número de teléfono del usuario utilizado para la autenticación. El formato del número de teléfono se basa en el código de país, el distintivo de zona y el número de línea sin separadores. |
El token del servidor se transmite en el encabezado X-SERVER-AUTHORIZATION
.
La carga útil del token contiene información sobre los recursos que posee el cliente de OAuth 2.0. El token tiene acceso a llamadas con autenticación basada en servidor para estos recursos.
Notificación | Tipo | Obligatoria | Descripción |
xsolla_login_project_id |
string (cadena) (UUID) | Sí | ID de un proyecto de Login que posee el cliente de OAuth 2.0. |
resources |
matriz | Sí |
Lista de recursos propiedad de un cliente de OAuth 2.0. Posibles tipos de recursos:
Cada grupo se escribe en el siguiente formato:
|
jti |
string | Sí | ID de token único. |
To validate the JWT, use the following Login API calls:
Aviso
No revele su clave secreta a nadie. Si se ha visto comprometida, cámbiela.
En caso de respuestas de error, el servidor Xsolla Login devuelve un objeto JSON con los siguientes campos:
Campo | Tipo | Descripción |
código | string | Código de error del servidor de Xsolla Login. |
descripción | string | Descripción del error. El texto está siempre en inglés. No utilice este texto en caso de error, ya que el valor puede cambiar en el futuro. |
{
"error": {
"code": "000-000",
"description": "description"
}
}
Error Code | Descripción | Recommendation |
---|---|---|
002-016 | The user should try to log in again. | |
002-027 | Make sure all request parameters are correct. | |
002-028 | Make sure all required parameters are provided. | |
002-040 | The user should contact the game support team. | |
002-043 | The user should try another phone number that can receive SMS. | |
002-050 | The error occurs when trying to enable two-factor authentication if it's already enabled, or disable it if it's already disabled. | |
002-056 | The user should verify the phone number or enter a different one. | |
002-057 | The user should try again later. If you believe this error should not occur, please contact the integrator team in any messenger. | |
002-058 | The user should use the link in the email to unblock their account or reset the password. | |
002-060 | Inform the user of the age restrictions. | |
003-001 | The user should verify the entered information and try again. | |
003-002 | The user should sign up in the game to continue. | |
003-003 | The user should try a different username. | |
003-004 | The user should use a different email address. | |
003-005 | The user should try a different email address. | |
003-007 | The user should confirm their email address to activate the account. If they haven't received a confirmation email, they should check the spam folder. | |
003-008 | Changing the email address is not allowed. | |
003-009 | The search failed for technical reasons, please try again later. | |
003-010 | Changing the birth date is not allowed. | |
003-011 | The user should confirm the email address or use another one that has not been previously used during registration. | |
003-012 | The user should confirm the phone number or use another one that has not been previously used during registration. | |
003-019 | Check the existence of the authentication variant with the passed ID. | |
003-020 | Check the authorization option settings in your Publisher Account. | |
003-021 | The user should contact game support. | |
003-022 | Verify the authorization option settings in your Publisher Account. | |
003-023 | Registration is not allowed for this authorization option. The user should contact game support. | |
003-030 | The password reset link has expired or is incorrect. The user should attempt to reset the password again. | |
003-049 | The user should try again later. | |
007-001 | The user should use an alternative login method. | |
008-001 | Add the correct login URL in the authorization option settings in your Publisher Account (section User database > Storage > Custom storage). | |
008-002 | Add the correct user verification URL in the authorization option settings in your Publisher Account (section User database > Storage > Custom storage). | |
008-003 | Add the correct URL in the authorization option settings in your Publisher Account (section User database > Storage > Custom storage). | |
008-004 | Add the correct password reset URL in the authorization option settings in your Publisher Account (section User database > Storage > Custom storage). | |
008-005 | Ensure the correct Title ID is specified in the authorization option settings in your Publisher Account (section User database > Storage). | |
008-006 | Ensure the PlayFab API key is valid. | |
008-008 | Ensure the server returns the accountID parameter in the response body. |
|
008-009 | Verify the URLs specified in the Custom storage settings in the authorization option in your Publisher Account (section User database > Storage > Custom storage). | |
008-011 | Ensure that the callback URL for password reset is specified in the authorization option settings in your Publisher Account (section Password settings). | |
008-013 | Ensure that a link to the user agreement is specified in the authorization option settings in your Publisher Account (section Legal Terms > Policies and Agreements). | |
008-014 | Contact the integration team through any messenger. | |
008-015 | Contact the integration team through any messenger. | |
008-016 | Add the API key to the settings in your Publisher Account (section Legal Terms > Policies and Agreements). | |
010-004 | The user should try again later. | |
010-005 | The user should try again later. | |
010-006 | The user should add another authentication method before unlinking the social network. | |
010-007 | The user should complete the CAPTCHA again. | |
010-010 | The user should verify the code and try again. | |
010-014 | The user should log in again from the login page. | |
010-015 | The user should try again later. | |
010-016 | The user should use a different social account. If they believe this is an error, they should contact the integration team through any messenger. | |
010-017 | Verify the correctness of the request parameters being sent. | |
010-019 | Ensure that a client with the provided client_id exists. |
|
010-020 | Ensure that the provided scope parameter is correct. Refer to the instructions for detailed setup information. |
|
010-021 | Ensure that the value of the response_type parameter is set to "code" . |
|
010-022 | Ensure that the state parameter is present and consists of at least 8 characters. | |
010-023 | Ensure that the authorization code is valid and not expired, and that the redirect_uri parameter contains an authorized URL. Refer to the instructions for detailed setup information. |
|
010-026 | Ensure that you have sufficient permissions to access the resource. | |
010-030 | Ensure that cross-authentication is enabled for the authorization option. Refer to the instructions for detailed setup information. | |
010-031 | The error occurs when attempting to connect a social network that is already enabled. | |
010-032 | Ensure that the social network is enabled and configured in the authorization option settings in your Publisher Account (section Authorization via Social Networks). | |
010-033 | The user should try again later. | |
010-035 | The user should try again later. | |
010-045 | The user should use a different social account for registration. | |
030-024 | The user should contact the game support team. | |
040-001 | The user should enter an email address containing no more than 254 characters. | |
040-002 | The user should enter a valid email address. | |
040-003 | The user should enter a different email address. | |
040-004 | The user should contact Xsolla support. | |
040-005 | The user should enter an email with only one @ character. |
|
040-006, 040-007, 040-008 | The user should contact Xsolla support. | |
040-009 | The user should enter an email with an existing domain. | |
040-010 | The user should contact Xsolla support. | |
010-018 | The user should enter a different email address. | |
300-003 | The user should try again later. | |
300-005 | The user should try again later. | |
300-006 | The user should verify and re-enter the confirmation code. | |
300-008 | The user should use the new code sent to their email or phone. | |
003-007 | The user should confirm their email address to activate the account. If they haven't received a confirmation email, they should check the spam folder. | |
003-025 | The user should try a different authentication method. | |
003-040 | The user should log in again. | |
003-033 | Ensure that shadow authentication is used for the authorization option. | |
2002-0001 | Make sure that the attribute being created has not been previously added to the user. |