Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This article describes three scenarios to implement player sign-in for games that use both Xbox services and PlayFab services. When your game uses these services together, players must be signed in to both their Xbox services account and their linked PlayFab user account.
Implement player sign-in by using the Microsoft Game Development Kit and Xbox services
Xbox service accounts are tied to various Xbox services, such as achievements, game saves, in-game purchases, multiplayer sessions, and player statistics.
If you're porting your game from a different game engine, we recommend using the Simplified User ModelAuthorization required. It ensures that before a game is launched, you have a default user who is signed in. This is the simplest method for signing in a player. There is also an Advanced User ModelAuthorization required that doesn't require a default user to be signed in.
The workflow for signing a player in to Xbox services by using the Simplified User Model is as follows.
- Initialize the Microsoft Game Development Kit (GDK) environment.
- Opt into the default user in MicrosoftGame.configAuthorization required.
- Use XUserRegisterForChangeEvent to register for player state changes.
- Call
XUserAddAsync
to add a player to the game. This method returns anXUserHandle
that represents the signed-in user.
You'll need to manage the XUserHandle
instances and sign-out events after the player successfully signs in.
See also (GDK)
For more information about signing players in with the GDK, see the following articles.
Xbox services authentication for title servicesAuthorization required
Establishing the Default User for the GameAuthorization required
Changing the Default User for the GameAuthorization required
Implement player sign-in by using PlayFab
PlayFab supports multiple ways of account authentication through its own authentication services and those from Microsoft. When your game uses PlayFab and Xbox services together, players must sign in to both their Xbox services account and their PlayFab user account.
We recommend using the PlayFab Services SDK for all games that use any PlayFab services. However, if Microsoft Azure PlayFab Party is the only PlayFab service your game uses and your game only uses Xbox services as an authentication provider, use the PlayFab Party Xbox Live Helper Library.
Implement player sign-in by using the PlayFab Services SDK
The PlayFab Services SDK includes the PFAuthenticationLoginWithXUserAsync function to authenticate Xbox players with PlayFab.
- Download and install the GDK.
- Add the PlayFab.Services.C Gaming Extension Library to your game project.
- Sign players in to their Xbox accounts by using XUserAddAsync. For details, see XUser.
- Use
PFAuthenticationLoginWithXUserAsync
from the PlayFab Services SDK to sign players in to PlayFab withXUserHandle
fromXUserAddAsync
.
Note
PlayFab makes a distinction between authenticating as a player and authenticating as a title entity. Some PlayFab APIs are not available to player entities. For example to prevent cheating, a player entity is able to read statistics but updating statistics requires being authenticated as a title.
Authentication as a title uses PFAuthenticationGetEntityWithSecretKeyAsync
and your title specific secret key. For more information, see Accessing PlayFab with a title entity
See also (PlayFab)
The PlayFab documentation is the best source of information about player sign-ins. Use it as a primary source.
For more information about signing players in with PlayFab, see the following articles.