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
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
Delete User
Deletes the currently signed in user permanently.
Declaration
UFUNCTION(BlueprintCallable, Category = "Unity Gaming Services | Authentication")static void DeleteUser(FAuthenticationDeleteUserDelegate ResponseDelegate)
Parameter
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
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 Credentials | Boolean | Option 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 Name | String | The 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 Name | String | The 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 |
|---|
| String | The 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 String | All 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
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
IsSignedIn
Checks whether the user is signed in or not.
Note
A user can remain signed in but have an expired session.
Declaration
UFUNCTION(BlueprintPure, Category = "Unity Gaming Services | Authentication")bool IsSignedIn() const
Returns
Type | Description |
|---|
| bool | True 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 |
|---|
| bool | True if user is signed in anonymously, else false. |
IsAuthorized
Checks whether the user is still authorized.
Note
A user is authorized as long as his access token remains valid.
Declaration
UFUNCTION(BlueprintPure, Category = "Unity Gaming Services | Authentication")bool IsAuthorized() const
Returns
Type | Description |
|---|
| bool | True 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 |
|---|
| bool | True 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 |
|---|
| bool | True 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 |
|---|
| Guid | The Unity project Id. |
GetUnityEnvironmentName
Returns the Unity environment name.
Declaration
UFUNCTION(BlueprintPure, Category = "Unity Gaming Services | Authentication")FString GetUnityEnvironmentName() const
Returns
Type | Description |
|---|
| String | The 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 |
|---|
| String | A 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 |
|---|
| String | A 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 |
|---|
| String | The 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
GetState
Sets the Unity Project Id.
Declaration
UFUNCTION(BlueprintCallable, Category = "Unity Gaming Services | Authentication")static void SetUnityProjectId(FGuid Value)
Parameters
Name | Type | Description |
|---|
| Value | Guid | The 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 |
|---|
| Value | String | The new Unity Environment Id. |