Prerequisites
-
Ensure that you integrate the PlayFab OSS as a plugin in your
<game>.build.csfile. In the below example, we create a toggle option to allow integration, and set a definition to allow for#ifdefguarding. -
Ensure that you integrate the PlayFab SDK Plugin in your
<game>.build.csfile. In the below example, we create a toggle option to allow integration, and set a definition to allow for#ifdefguarding. -
After you update your
<game.build.cs>file (and every subsequent time you update it), be sure to regenerate your game’s Visual Studio project files by right-clicking your.uprojectfile and selectingGenerate Visual Studio Project Files. -
PlayFab OSS now offers a public
AuthenticateUserCompletedelegate that triggers on completion of the PlayFab OSS user authentication flow. Bind to this delegate to retrieve the details of your PlayFab OSS authentication.
Steps
You can also jump to the Full Code Example.-
Include the Correct Headers
-
Retrieve the PlayFab OSS
-
Bind to the
AuthenticateUserCompletedelegateFunctions that bind to this delegate must have the same signature as the delegate. For example:You can also bind a lambda to the delegate. For example: -
Handle Authentication Result: In the function bound to the delegate, handle the result of the authentication. If the authentication is successful, retrieve the authenticated local user via the
platformUserIdStrfrom the delegate trigger. Then, construct a PlayFabLoginResultfrom the PlayFab OSSLocalUser. -
Use PlayFab SDK Plugin APIs: With
LoginResultpopulated, you can now use the PlayFab SDk Plugin APIs however you wish. This state is considered “authenticated”.
