Blueprint Integration

Add the Authentication SDK as a dependency

Before you continue with the following blueprint demonstrations, make sure you’ve successfully installed the Authentication SDK plugin and can view Authentication-related functions in a Blueprint’s event graph or function under Unity Gaming Services > Authentication.

All actions for this blueprint.

Sign In Anonymously

Use Sign In Anonymously to anonymously authenticate. This is a quick way to authenticate without any user information, and requires no interaction with external providers. If successful, this populates the current player profile with the retrieved credentials returned from the Unity Authentication servers.

Sign In Anonymously takes an FAuthenticationSignInOptions struct as a parameter that changes the way a sign-in is performed. More information about these parameters can be found on the official Unity API services documentation page.

The response from the SDK can be handled in a custom event, which needs to take in an Authentication Response as an output pin. To isolate response variables, right-click the response body output pin and select Split Pin.

Sign in anonymously

Get User Info

Use Get User Info to retrieve information about the currently authenticated user. This includes their user Id, authentication timestamps, and any external Identity providers that are linked to their session.

The response from the SDK can be handled in a custom event, which needs to take in an Authentication User Response as an output pin, representing the user response from the Authentication SDK. To isolate response variables, right-click the response body output pin and select Split Pin.

Get user info

Delete User

Use Delete User to delete all information related to the currently authenticated player. This function also signs out the player, and deletes all player preferences and profiles connected to the player.

The response from the SDK can be handled in a custom event, which needs to take in a Boolean as an output pin, representing whether the deletion was a success.

Delete user

Register State Changed Callback

Use Register State Changed Callback to assign a callback function that invokes upon the state of the subsystem changing. For instance, the assigned function executes when a player has successfully authenticated and the subsystem state has changed to Authorized.

The response from the SDK can be handled in a custom event, which needs to take in an Authentication State Changed Response as an output pin, representing the response from the Authentication SDK. To isolate response variables, right-click the response body output pin and select Split Pin.

Register state changed callback

Sign Out

Use Sign Out to sign-out of the currently authenticated player profile. This removes the current player profile and switches to the default profile. This function also has an optional parameter to remove any stored credentials associated with this player.

Note: If Sign Out is used while using the default profile, then the profile information is cleared and the profile stays intact.

This function returns a Boolean representing whether the operation was a success.

alt_text

Switch Profile

Use Switch Profile to switch to, or create, a player profile.

Note: Switch Profile can only be called while signed-out. If a profile switch is invoked while authenticated, a warning is logged and nothing happens.

Switch profile

Profile Exists

Use Profile Exists to check if a given profile exists in the current session.

Note: Profile Exists cannot detect profiles from previous sessions that have not been re-created in the current session.

This function returns a Boolean representing whether the given profile name exists in the current list of player profiles.

Profile exists

Get Current Profile Name

Use Get Current Profile Name to retrieve the name of the current player profile.

This function returns a String representing the name of the current player profile being used by the Authentication subsystem.

Get current profile name

Get Profile Names

Use Get Current Profile Names to retrieve a list of all player profile names being used in the current session.

This function returns a String Array representing all the names of the player profiles being used by the Authentication subsystem.

Get profile names

Register Profile Changed Callback

Use Register Profile Changed Callback to assign a callback function that invokes when a player profile changes. For instance, the assigned function executes when Switch Profile has executed successfully.

The response from the SDK can be handled in a custom event, which needs to take in an Authentication Player Profile Changed Response as an output pin. To isolate response variables, right-click the response body output pin and select Split Pin.

Register profile changed callback

Register Profile Deleted Callback

Use the Register Profile Changed Callback function to assign a callback function that invokes when a player profile is removed from the current session. For instance, the assigned function executes when Sign Out has executed successfully.

The response from the SDK can be handled in a custom event, which needs to take in an [Authentication Player Profile] Authentication Player Profile Deleted Response as an output pin. To isolate response variables, right-click the response body output pin and select Split Pin.

Register profile deleted callback

Is Signed In

Use Is Signed In to check whether the current player profile is signed-in. Being “Signed-In” is defined as being either Authorized or Expired.

This function returns a Boolean representing whether the current player profile is signed-in.

Is signed in

Is Anonymous

Use Is Anonymous to check whether the current player profile is signed-in anonymously. This should return true after executing Sign In Anonymously successfully.

This function returns a Boolean representing whether the current player profile is signed-in anonymously. If the last sign-in was anonymous, this returns true even if the session has expired.

Is anonymous

Is Authorized

Use Is Authorized to check whether the current player profile is signed-in and currently authorized.

This function returns a Boolean representing whether the current player profile is signed-in and has been authorized successfully. This should return true after executing any sign-in function while the expiration time has not yet passed.

Is authorized

Is Expired

Use Is Expired to check whether the current player profile’s session has expired.

This function returns a Boolean representing whether the current player profile’s session has gone past the returned expiry time from its initial Authentication Response.

Is expired

Session Token Exists

Use Session Token Exists to check whether a session token exists in player preferences for the current player profile.

This function returns a Boolean representing whether the session token exists.

Session tokene exists

Get Unity Project Id

Use Get Unity Project Id to retrieve the Unity Project Id associated with the current authentication session.

This function returns a Guid representing the current Project Id in use.

Get Unity project ID

Get Unity Environment Name

Use Get Unity Environment Name to retrieve the name of the Unity Environment Name associated with the current authentication session.

This function returns a String representing the current Environment in use.

Get Unity Environment Name

Get Access Token

Use Get Access Token to retrieve the access token for the current session. If none exists, this returns an empty string.

Get access token

Get Session Token

Use Get Session Token to retrieve the session token for the current session. If none exists, this returns an empty string.

Get session token

Get User Id

Use the Get User Id function to retrieve the user Id for the current session.

Note: This is different from the player profile name. The user Id is the unique user identifier returned from the Unity Authentication System.

This function returns a String representing the current player profile’s user Id. If none exists, this returns an empty string.

Get user ID

Get State

Use the Get State function to retrieve the current state of the authentication session.

This function returns an Enum representing the state of the subsystem.

Get state

Set Unity Project Id

Use Set Unity Project Id to set the Unity Project Id for the current authentication session. This function takes a Guid.

Note: This overrides the Unity Project Id configured in Project Settings.

Set Unity project ID

Set Unity Environment Name

Use Set Unity Environment Name to set the Unity Environment Name for the current authentication session. This function takes a String.

Note: This overrides the Unity Environment Name configured in Project Settings.

Set Unity Environment Name