PlayFab storage
If you use PlayFab storage, you have access to:
- user registration
- authentication via user email address and password
- authentication via Twitch
- user password reset
- user blocking
Interaction flow
You can use the Login widget or your application as a client. The interaction flow between the client and the Xsolla Login server is the following:
- The client sends requests to the Xsolla Login server. The requests format is described in JWT, OAuth 2.0, and Password endpoints.
- The Xsolla Login server sends requests to PlayFab.
- The Xsolla Login server processes a response from PlayFab and returns results to the client.
- The client processes the response.
User registration in PlayFab
User registration follows this flow. You can set up the account confirmation email that your users get to complete their registration.
User registration flow
- The client sends the
Register new user request to the Xsolla Login server. - The Xsolla Login server sends a registration request.
- User data is written to the Xsolla database.
- The Xsolla Login server sends a request to PlayFab to change user data.
- If you have set up account confirmation:
- When you use the Login API calls for integrating the solution, registration is considered complete.
- When you use the Login widget for integrating the solution, the user is redirected to a page with the following message: The account confirmation email is sent to {email address}.
User account confirmation in PlayFab
To set up sending the account confirmation email, complete the following steps:- Follow the instruction to set up your project in PlayFab.
- Make sure you have completed the Create an email template and Create a rule to send an email when a contact email is updated steps from the Requirements module.
- Contact your Customer Success Manager or email to csm@xsolla.com.
Authentication via user email address and password
There are two types of authentication via user email address and password: JWT standard-based authentication and OAuth 2.0 protocol-based authentication.
- The user data is written there.
- The Xsolla Login server sends the request to change data in PlayFab.
JWT standard-based authentication flow
- The client sends the Auth by username and password request to the Xsolla Login server.
- The Xsolla Login server sends the authentication request to PlayFab.
- The Xsolla Login server generates a user JWT, while:
- The PlayFabId value from the response to the PlayFab request is written to the
external_account_id
claim. - The SessionTicket value from the response to the PlayFab request is written to the
session_ticket
claim. - The EntityToken values from the response to the PlayFab request is written to the
entity_token
,entity_id
,entity_type
claims.
- The PlayFabId value from the response to the PlayFab request is written to the
- The user is redirected to
login_url
with a query parametertoken
. The user JWT is written to thetoken
parameter.
OAuth 2.0 protocol-based authentication flow
- The client sends the Auth by username and password request with the
redirect_uri
parameter to the Xsolla Login server. - The Xsolla Login server sends the authentication request to PlayFab.
- The Xsolla Login server returns
login_url
along withcode
in the query parameter and the passedredirect_uri
parameter. - The user is redirected to
redirect_uri
with the query parametercode
. - The client sends the Generate JWT request to the Xsolla Login server to exchange the received
code
for a user JWT. - The Xsolla Login server generates a user JWT, while:
- The PlayFabId value from the response to the PlayFab request is written to the
external_account_id
claim. - The SessionTicket value from the response to the PlayFab request is written to the
session_ticket
claim if you passedscope=playfab
to the Auth by username and password request. - The EntityToken values from the response to the PlayFab request is written to the
entity_token
,entity_id
,entity_type
claims.
- The PlayFabId value from the response to the PlayFab request is written to the
Authentication via Twitch
You should set up a social network in PlayFab to authenticate users via Twitch. There are two types of authentication via Twitch — JWT standard-based and OAuth 2.0 protocol-based authentication.
JWT standard-based authentication flow
- The client sends the Auth via social network request to the Xsolla Login server.
- The Xsolla Login server sends the authentication request to PlayFab.
- The user data is written to the Xsolla database.
- The Xsolla Login server generates a user JWT, while:
- The PlayFabId value from the response to the PlayFab request is written to the
external_account_id
claim. - The SessionTicket value from the response to the PlayFab request is written to the
session_ticket
claim. - The EntityToken values from the response to the PlayFab request is written to the
entity_token
,entity_id
,entity_type
claims.
- The PlayFabId value from the response to the PlayFab request is written to the
- The user is redirected to
login_url
with a query parametertoken
. The user JWT is written to thetoken
parameter.
OAuth 2.0 protocol-based authentication flow
- The client sends the Auth via social network request with the
redirect_uri
parameter to the Xsolla Login server. - The Xsolla Login server sends the authentication request to PlayFab.
- The user data is written to the Xsolla database.
- The Xsolla Login server sends the request to change data in PlayFab.
- The user is redirected to
redirect_uri
with a query parametercode
. - The client sends the Generate JWT request to the Xsolla Login server to exchange the received
code
for a user JWT. - The Xsolla Login server generates a user JWT, while:
- The PlayFabId value from the response to the PlayFab request is written to the
external_account_id
claim. - The SessionTicket value from the response to the PlayFab request is written to the
session_ticket
claim if you passedscope=playfab
to the Twitch authentication request. - The EntityToken values from the response to the PlayFab request is written to the
entity_token
,entity_id
,entity_type
claims.
- The PlayFabId value from the response to the PlayFab request is written to the
Set up Twitch authentication
- Create your Twitch account and get a Twitch Client ID.
- Go to Publisher Account and open your project > Login.
- Click Configure in the panel of the required Login project.
- Go to the Authentication block and select the Social login section.
- Go to the Twitch social network panel, click the ⚙ icon and select Settings.
- Enter your Twitch Client ID in the Application ID field.
- If necessary, change other settings.
- Click Connect.
- Set up Twitch in your PlayFab account.
- If you have integrated the Login product via the Login API calls:
User password reset
The user password reset flow is the following:
- The client sends the Reset password request to the Xsolla Login server.
- The Xsolla Login server sends the password reset request to PlayFab.
- The updated password is written to PlayFab.
User blocking
You can block users via Publisher Account. Blocked users cannot authenticate. The blocking will be recorded and saved on the Xsolla side only.
Continue reading
Useful links
How to connect PlayFab storageFound a typo or other text error? Select the text and press Ctrl+Enter.