Documentation

Support

Authentication for Unreal Engine

Authentication overview

Authentication for Unreal Engine

Class UAuthenticationBlueprintApi

Reference the Blueprint Application Programming Interface for authentication operations.
Read time 5 minutesLast updated 2 hours ago

Declaration
UCLASS()class UAuthenticationBlueprintApi : public UBlueprintFunctionLibrary

Delegates

FAuthenticationResponseDelegate

Declaration

DECLARE_DYNAMIC_DELEGATE_OneParam(FAuthenticationResponseDelegate, FAuthenticationResponse, Response)

Return Type

FAuthenticationResponse

FAuthenticationStateChangedResponseDelegate

Declaration

DECLARE_DYNAMIC_DELEGATE_OneParam(FAuthenticationStateChangedResponseDelegate, FAuthenticationStateChangedResponse, Response)

Return Type

FAuthenticationStateChangedResponse

FAuthenticationGetUserDelegate

Declaration

DECLARE_DYNAMIC_DELEGATE_OneParam(FAuthenticationGetUserDelegate, FAuthenticationUserResponse, Response)

Return Type

FAuthenticationUserResponse

FAuthenticationDeleteUserDelegate

Declaration

DECLARE_DYNAMIC_DELEGATE_OneParam(FAuthenticationDeleteUserDelegate, bool, bResponse)

Return Type

Boolean

FAuthenticationPlayerProfileChangedResponseDelegate

Declaration

DECLARE_DYNAMIC_DELEGATE_OneParam(FAuthenticationPlayerProfileChangedResponseDelegate, FAuthenticationPlayerProfileChangedResponse, Response)

Return Type

FAuthenticationPlayerProfileChangedResponse

FAuthenticationPlayerProfileDeletedResponseDelegate

Declaration

DECLARE_DYNAMIC_DELEGATE_OneParam(FAuthenticationPlayerProfileDeletedResponseDelegate, FAuthenticationPlayerProfileDeletedResponse, Response)

Return Type

FAuthenticationPlayerProfileDeletedResponse

Methods

Sign In Anonymously

Signs in the current user anonymously. No credentials are required and the session is confined to the current device.

Declaration

UFUNCTION(BlueprintCallable, Category = "Unity Gaming Services | Authentication")static void SignInAnonymously(FAuthenticationSignInOptions Options, FAuthenticationResponseDelegate ResponseDelegate)

Parameters

Name

Type

Description

OptionsFAuthenticationSignInOptionsOptions for sign-in.
Response DelegateFAuthenticationResponseDelegateDelegate that executes when the API has returned a response.

Get User Info

Returns the current player's player info, such as account creation time and linked external ids.

Declaration

UFUNCTION(BlueprintCallable, Category = "Unity Gaming Services | Authentication")void GetUserInfo(FAuthenticationGetUserDelegate ResponseDelegate) const

Parameter

Name

Type

Description

Response DelegateFAuthenticationGetUserDelegateDelegate that executes when the API has returned a response.

Delete User

Deletes the currently signed in user permanently.

Declaration

UFUNCTION(BlueprintCallable, Category = "Unity Gaming Services | Authentication")static void DeleteUser(FAuthenticationDeleteUserDelegate ResponseDelegate)

Parameter

Name

Type

Description

Response DelegateFAuthenticationDeleteUserDelegateDelegate that executes when the API has returned a response.

Register State Changed Callback

Hooks into a delegate that executes upon the authentication state changing.

Declaration

UFUNCTION(BlueprintCallable, Category = "Unity Gaming Services | Authentication")static void RegisterStateChangedCallback(FAuthenticationStateChangedResponseDelegate ResponseDelegate)

Parameter

Name

Type

Description

Response DelegateFAuthenticationStateChangedResponseDelegateDelegate that executes upon the authentication state changing.

Sign Out

Signs-out the current user under the provided profile name.

Declaration

UFUNCTION(BlueprintCallable, Category = "Unity Gaming Services | Authentication")static bool SignOut(bool bClearCredentials = false)

Parameter

Name

Type

Description

Clear CredentialsBooleanOption to clear the session token that enables logging in to the same account.

Switch Profile

Switches the current profile to a new profile name. If a profile was not found under that name, a new one is created.

Declaration

UFUNCTION(BlueprintCallable, Category = "Unity Gaming Services | Authentication")void SwitchProfile(FString ProfileName)

Parameters

Name

Type

Description

Profile NameStringThe name of the profile to switch to, or add if it does not yet exist.

Profile Exists

Check if a profile exists.

Declaration

UFUNCTION(BlueprintPure, Category = "Unity Gaming Services | Authentication")bool ProfileExists(FString ProfileName) const

Parameters

Name

Type

Description

Profile NameStringThe name of the profile to check.

Get Current Profile Name

Returns the name of the current profile.

Declaration

UFUNCTION(BlueprintPure, Category = "Unity Gaming Services | Authentication")FString GetCurrentProfileName() const

Returns

Type

Description

StringThe name of the current profile.

Get Profile Names

Returns all active player profile names.

Declaration

UFUNCTION(BlueprintPure, Category = "Unity Gaming Services | Authentication")TArray<FString> GetProfileNames() const

Returns

Type

Description

Array of StringAll the active player profile names.

Register Profile Changed Callback

Hooks into a Handler that executes upon the player profile changing.

Declaration

UFUNCTION(BlueprintCallable, Category = "Unity Gaming Services | Authentication")void RegisterProfileChangedCallback(FAuthenticationPlayerProfileChangedResponseDelegate ResponseDelegate)

Parameters

Name

Type

Description

Response DelegateFAuthenticationPlayerProfileChangedResponseDelegateHandler that executes upon the player profile changing.

Register Profile Deleted Callback

Hooks into a Handler that executes upon a player profile getting deleted.

Declaration

UFUNCTION(BlueprintCallable, Category = "Unity Gaming Services | Authentication")void RegisterProfileDeletedCallback(FAuthenticationPlayerProfileDeletedResponseDelegate ResponseDelegate)

Parameter

Name

Type

Description

Response DelegateFAuthenticationPlayerProfileDeletedResponseDelegateHandler that executes upon a player profile getting deleted.

IsSignedIn

Checks whether the user is signed in or not.

Declaration

UFUNCTION(BlueprintPure, Category = "Unity Gaming Services | Authentication")bool IsSignedIn() const

Returns

Type

Description

boolTrue if user is signed in, else false.

IsAnonymous

Checks whether the user is signed in anonymously.

Declaration

UFUNCTION(BlueprintPure, Category = "Unity Gaming Services | Authentication")bool IsAnonymous() const

Returns

Type

Description

boolTrue if user is signed in anonymously, else false.

IsAuthorized

Checks whether the user is still authorized.

Declaration

UFUNCTION(BlueprintPure, Category = "Unity Gaming Services | Authentication")bool IsAuthorized() const

Returns

Type

Description

boolTrue if user is authorized, else false.

IsExpired

Checks whether the user session is expired.

Declaration

UFUNCTION(BlueprintPure, Category = "Unity Gaming Services | Authentication")bool IsExpired() const

Returns

Type

Description

boolTrue if user's session expired, else false.

SessionTokenExists

Checks if there is an existing session token stored for the current profile.

Declaration

UFUNCTION(BlueprintPure, Category = "Unity Gaming Services | Authentication")bool SessionTokenExists() const

Returns

Type

Description

boolTrue if there is an existing session token stored for the current profile.

GetUnityProjectId

Returns the Unity project Id.

Declaration

UFUNCTION(BlueprintPure, Category = "Unity Gaming Services | Authentication")FGuid GetUnityProjectId() const

Returns

Type

Description

GuidThe Unity project Id.

GetUnityEnvironmentName

Returns the Unity environment name.

Declaration

UFUNCTION(BlueprintPure, Category = "Unity Gaming Services | Authentication")FString GetUnityEnvironmentName() const

Returns

Type

Description

StringThe Unity environment name.

GetAccessToken

Returns the current user's access token.

Declaration

UFUNCTION(BlueprintPure, Category = "Unity Gaming Services | Authentication")FString GetAccessToken() const

Returns

Type

Description

StringA string of current user's access token when they are signed in, otherwise an empty string.

GetSessionToken

Returns the current user's session token.

Declaration

UFUNCTION(BlueprintPure, Category = "Unity Gaming Services | Authentication")FString GetSessionToken() const

Returns

Type

Description

StringA string of current user's session token when they are signed in, otherwise an empty string.

GetUserId

The current user's Id when they are signed in.

Declaration

UFUNCTION(BlueprintPure, Category = "Unity Gaming Services | Authentication")FString GetUserId() const

Returns

Type

Description

StringThe current user's Id when they are signed in, otherwise an empty string.

GetState

The current state of the authentication subsystem.

Declaration

UFUNCTION(BlueprintPure, Category = "Unity Gaming Services | Authentication")EAuthenticationStates GetState() const

Returns

Type

Description

Authentication StatesThe current state of the authentication subsystem.

GetState

Sets the Unity Project Id.

Declaration

UFUNCTION(BlueprintCallable, Category = "Unity Gaming Services | Authentication")static void SetUnityProjectId(FGuid Value)

Parameters

Name

Type

Description

ValueGuidThe new Unity Project Id.

SetUnityEnvironmentName

Sets the Unity Environment name.

Declaration

UFUNCTION(BlueprintCallable, Category = "Unity Gaming Services | Authentication")static void SetUnityEnvironmentName(FString Value)

Parameters

Name

Type

Description

ValueStringThe new Unity Environment Id.