Class Authentication subsystem
Subsystem for handling connections to the Unity Authentication system.
Include
#include "AuthenticationSubsystem.h"Syntax
UCLASS()
class AUTHENTICATION_API UAuthenticationSubsystem : public UGameInstanceSubsystemConstructors
UAuthenticationSubsystem()
Default constructor for the Authentication subsystem.
Declaration
UAuthenticationSubsystem()UAuthenticationSubsystem(FVTableHelper&)
Override constructor for forward declaration.
Declaration
UAuthenticationSubsystem(FVTableHelper& Helper)Parameters
| Name | Description | 
|---|---|
| Helper | Helper class to invoke specialized hot-reload constructor. | 
Destructors
~UAuthenticationSubsystem()
Default destructor for the Authentication subsystem.
Declaration
virtual ~UAuthenticationSubsystem()Overrides
Initialize(FSubsystemCollectionBase&)
Initialize overrides from USubsystem.
Declaration
virtual void Initialize(FSubsystemCollectionBase& Collection) overrideDeinitialize()
Initialize overrides from USubsystem.
Declaration
virtual void Deinitialize() overrideShouldCreateSubsystem(UObject*)
Initialize overrides from USubsystem.
Declaration
virtual bool ShouldCreateSubsystem(UObject* Outer) const overrideMethods
SignInAnonymously(FAuthenticationSignInOptions, Unity::Services::Core::THandler<FAuthenticationResponse>)
Signs in the current user anonymously. No credentials are required and the session is confined to the current device.
Declaration
void SignInAnonymously(FAuthenticationSignInOptions Options, Unity::Services::Core::THandler<FAuthenticationResponse> ResponseHandler)Parameters
| Name | Type | Description | 
|---|---|---|
Options | FAuthenticationSignInOptions | Options for sign-in. | 
ResponseHandler | THandler<FAuthenticationResponse> | Handler that executes when the API has returned a response. | 
GetUserInfo(Unity::Services::Core::THandler<FAuthenticationUserResponse>)
Returns the current player's player info, such as account creation time and linked external ids.
Declaration
void GetUserInfo(Unity::Services::Core::THandler<FAuthenticationUserResponse> ResponseHandler)Parameters
| Name | Type | Description | 
|---|---|---|
ResponseHandler | THandler<FAuthenticationUserResponse> | Handler that executes when the API has returned a response. | 
DeleteUser(Unity::Services::Core::THandler<bool>)
Deletes the currently signed in user permanently.
Declaration
void DeleteUser(Unity::Services::Core::THandler<bool> ResponseHandler)Parameters
| Name | Type | Description | 
|---|---|---|
ResponseHandler | THandler<bool> | Handler that executes when the API has returned a response. | 
RegisterStateChangedCallback(Unity::Services::Core::THandler<FAuthenticationStateChangedResponse>)
Hooks into a delegate that executes upon the authentication state changing.
Declaration
void RegisterStateChangedCallback(Unity::Services::Core::THandler<FAuthenticationStateChangedResponse> ResponseHandler)Parameters
| Name | Type | Description | 
|---|---|---|
ResponseHandler | THandler<FAuthenticationStateChangedResponse> | Handler that executes upon the authentication state changing. | 
SignOut(bool)
Signs-out the current user under the provided profile name.
Declaration
bool SignOut(bool bClearCredentials = false)Parameters
| Name | Type | Description | 
|---|---|---|
bClearCredentials | bool | Option to clear the session token that enables logging in to the same account. | 
SwitchProfile(const FString&)
Switches the current profile to a new profile name. If a profile was not found under that name, a new one is created.
Declaration
void SwitchProfile(const FString& ProfileName) constParameters
| Parameter Name | Parameter Type | Description | 
|---|---|---|
ProfileName | FString | The name of the profile to switch to, or add if it does not yet exist. | 
ProfileExists(const FString&)
Check if a profile exists.
Declaration
const bool ProfileExists(const FString& ProfileName) constParameters
| Name | Type | Description | 
|---|---|---|
ProfileName | FString | The name of the profile to check. | 
Returns
| Type | Description | 
|---|---|
bool | True if the profile exists, false if it does not. | 
GetCurrentProfileName()
Returns the name of the current profile.
Declaration
const FString GetCurrentProfileName() constReturns
| Type | Description | 
|---|---|
| FString | The name of the current profile. | 
GetProfileNames()
Returns all active player profile names.
Declaration
const TArray<FString> GetProfileNames() constReturns
| Type | Description | 
|---|---|
| TArray<FString> | All the active player profile names. | 
RegisterProfileChangedCallback(Unity::Services::Core::THandler<FAuthenticationPlayerProfileChangedResponse>)
Hooks into a Handler that executes upon the player profile changing.
Declaration
void RegisterProfileChangedCallback(Unity::Services::Core::THandler<FAuthenticationPlayerProfileChangedResponse> ResponseHandler)Parameters
| Name | Type | Description | 
|---|---|---|
ResponseHandler | THandler<FAuthenticationPlayerProfileChangedResponse> | Handler that executes upon the player profile changing. | 
RegisterProfileDeletedCallback(Unity::Services::Core::THandler<FAuthenticationPlayerProfileDeletedResponse> ResponseHandler)
Hooks into a Handler that executes upon a player profile getting deleted.
Declaration
void RegisterProfileDeletedCallback(Unity::Services::Core::THandler<FAuthenticationPlayerProfileDeletedResponse> ResponseHandler)Parameters
| Name | Type | Description | 
|---|---|---|
ResponseHandler | THandler<FAuthenticationPlayerProfileDeletedResponse> | Handler that executes upon a player profile getting deleted. | 
IsSignedIn()
Checks whether the user is signed in or not.
A user can remain signed in but have an expired session.
Declaration
bool IsSignedIn() constReturns
| Type | Description | 
|---|---|
bool | True if user is signed in, else false. | 
IsAnonymous()
Checks whether the user is signed in anonymously.
Declaration
bool IsAnonymous() constReturns
| Type | Description | 
|---|---|
bool | True if user is signed in anonymously, else false. | 
IsAuthorized()
Checks whether the user is still authorized.
A user is authorized as long as his access token remains valid.
Declaration
bool IsAuthorized() constReturns
| Type | Description | 
|---|---|
bool | True if user is authorized, else false. | 
IsExpired()
Checks whether the user session is expired.
Declaration
bool IsExpired() constReturns
| 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
bool SessionTokenExists() constReturns
| Type | Description | 
|---|---|
bool | True if there is an existing session token stored for the current profile. | 
GetUnityProjectId()
Returns the Unity project Id.
Declaration
const FGuid GetUnityProjectId() constReturns
| Type | Description | 
|---|---|
| FGuid | The Unity project Id. | 
GetUnityEnvironmentName()
Returns the Unity environment name.
Declaration
const FString GetUnityEnvironmentName() constReturns
| Type | Description | 
|---|---|
| FString | The Unity environment name. | 
GetAccessToken()
Returns the current user's access token.
Declaration
FString GetAccessToken() constReturns
| Type | Description | 
|---|---|
| FString | 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
const const FString GetSessionToken() constReturns
| Type | Description | 
|---|---|
| FString | 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
const FString GetUserId() constReturns
| Type | Description | 
|---|---|
| FString | The current user's Id when they are signed in, otherwise an empty string. | 
GetState()
The current state of the authentication subsystem.
Declaration
const EAuthenticationStates GetState() constReturns
| Type | Description | 
|---|---|
| EAuthenticationStates | The current state of the authentication subsystem. | 
SetUnityProjectId(FGuid)
Sets the Unity Project Id.
Declaration
void SetUnityProjectId(FGuid Value)Parameters
| Name | Type | Description | 
|---|---|---|
| Value | FGuid | The new Unity Project Id. | 
SetUnityEnvironmentName(FString)
Sets the Unity Environment name.
Declaration
void SetUnityEnvironmentName(FString Value)Parameters
| Name | Type | Description | 
|---|---|---|
| Value | FString | The new Unity Environment Id. |