Loading...
Searching...
No Matches
FOnlineAsyncTaskAccelByteLogin Class Reference

#include <OnlineAsyncTaskAccelByteLogin.h>

Inheritance diagram for FOnlineAsyncTaskAccelByteLogin:
FOnlineAsyncTaskAccelByte AccelByte::TSelfPtr< FOnlineAsyncTaskAccelByteLogin, ESPMode::ThreadSafe > FOnlineAsyncTaskAccelByteSimultaneousLogin

Public Member Functions

 FOnlineAsyncTaskAccelByteLogin (FOnlineSubsystemAccelByte *const InABSubsystem, int32 InLocalUserNum, const FOnlineAccountCredentialsAccelByte &InAccountCredentials, bool bInCreateHeadlessAccount=true)
virtual void Initialize () override
virtual void Finalize () override
virtual void TriggerDelegates () override
virtual void OnTaskTimedOut () override
Public Member Functions inherited from FOnlineAsyncTaskAccelByte
 FOnlineAsyncTaskAccelByte (FOnlineSubsystemAccelByte *const InABSubsystem, bool bInShouldUseTimeout=true)
 FOnlineAsyncTaskAccelByte (FOnlineSubsystemAccelByte *const InABSubsystem, int32 InLocalUserNum, bool bInShouldUseTimeout=true)
 FOnlineAsyncTaskAccelByte (FOnlineSubsystemAccelByte *const InABSubsystem, int32 InLocalUserNum, int32 InFlags)
 FOnlineAsyncTaskAccelByte (FOnlineSubsystemAccelByte *const InABSubsystem, int32 InLocalUserNum, int32 InFlags, TSharedPtr< FAccelByteKey > InLockKey)
virtual void Tick (double Delta)
virtual bool HasTaskTimedOut ()
void ForcefullySetTimeoutState ()
virtual FString ToString () const override
EAccelByteAsyncTaskState GetCurrentState ()
int32 GetLocalUserNum ()
virtual void SetParentTask (FOnlineAsyncTaskAccelByte *Task)
virtual FOnlineAsyncTaskAccelByteGetParentTask ()
virtual bool HasParent ()
virtual void SetEpicForThisTask (FOnlineAsyncEpicTaskAccelByte *AssignedEpic)
bool SetLocalUserNum (int32 InLocalUserNum)

Protected Member Functions

virtual const FString GetTaskName () const override
void LoginWithNativeSubsystem ()
void LoginWithSpecificSubsystem (IOnlineSubsystem *NativeSubsystem)
void LoginWithSpecificSubsystem (FName InSubsystemName)
virtual void OnSpecificSubysystemLoginComplete (int32 LocalUserNum, bool bWasSubsystemLoginSuccessful, const FUniqueNetId &SubsystemUserId, const FString &SubsystemError, IOnlineSubsystem *SpecificSubsystem)
void OnSpecificSubysystemLoginUIClosed (FUniqueNetIdPtr UniqueId, const int ControllerIndex, const FOnlineError &SubsystemError, IOnlineSubsystem *SpecificSubsystem)
virtual void PerformLogin (const FOnlineAccountCredentials &Credentials)
virtual void OnLoginSuccess ()
virtual void OnLoginSuccessV4 (const FAccelByteModelsLoginQueueTicketInfo &TicketInfo)
virtual void Tick () override
void OnLoginErrorOAuth (int32 ErrorCode, const FString &ErrorMessage, const FErrorOAuthInfo &ErrorObject)
void OnLoginQueueCancelled (int32 InLocalUserNum)
void OnLoginQueueTicketClaimed (int32 InLocalUserNum, bool bWasClaimSuccessful, const FErrorOAuthInfo &ErrorObject)
bool ShouldInitiateNativePlatformLogin (FOnlineAccountCredentials const &InAccountCredentials, FName &OutSubsystemName)
bool FetchOculusPlatformToken ()
void OnFetchOculusPlatformTokenFinished (const FString &Token)
Protected Member Functions inherited from FOnlineAsyncTaskAccelByte
void CompleteTask (const EAccelByteAsyncTaskCompleteState &InCompleteState)
virtual void SetLastUpdateTimeToCurrentTime ()
template<typename T>
void RaiseGenericError (T Args)
void RaiseGenericError ()
template<>
void RaiseGenericError (FString &InErrorStrMember)
template<>
void RaiseGenericError (FOnlineError &InOnlineError)
template<>
void RaiseGenericError (FOnlineErrorAccelByte &InOnlineError)
template<typename T>
void RaiseGenericServerError (T Args)
void RaiseGenericServerError ()
template<>
void RaiseGenericServerError (FString &InErrorStrMember)
template<>
void RaiseGenericServerError (FOnlineError &InOnlineError)
template<>
void RaiseGenericServerError (FOnlineErrorAccelByte &InOnlineError)
virtual AccelByte::FApiClientPtr GetApiClient (int32 InLocalUserNum)
virtual AccelByte::FApiClientPtr GetApiClient (FUniqueNetIdAccelByteUserRef const &InUserId)
virtual FAccelByteInstanceWPtr GetAccelByteInstance ()
AccelByte::FApiClientPtr GetApiClientInternal ()
void SetApiClient (AccelByte::FApiClientPtr Input)
bool IsApiClientValid ()
void GetOtherUserIdentifiers ()
virtual void OnTaskStartWorking ()
bool HasFlag (const EAccelByteAsyncTaskFlags &Flag) const
bool HasFlag (uint8 FlagBit) const
void ExecuteCriticalSectionAction (FVoidHandler Action)

Protected Attributes

FOnlineAccountCredentialsAccelByte AccountCredentials
FString ErrorStr
FErrorOAuthInfo ErrorOAuthObject
int32 ErrorCode
EAccelByteLoginType LoginType
TSharedPtr< FUserOnlineAccountAccelByteAccount
TSharedPtr< FOnlineUserCacheAccelByte, ESPMode::ThreadSafe > UserCache
ELoginStatus::Type LoginStatus = ELoginStatus::NotLoggedIn
FAccelByteTimerObject TimerObject
bool bRetryLoginSkipExternalUI {false}
FUniqueNetIdPtr NativePlatformPlayerId = nullptr
FUniqueNetIdPtr SecondaryPlatformPlayerId = nullptr
FOnlineAccountCredentials NativePlatformCredentials {}
bool bLoginPerformed {false}
FString PlatformId {}
bool bCreateHeadlessAccount = true
bool bIsNativePlatformCredentialLogin = true
bool bLoginInQueue = false
FDelegateHandle LoginCompletedHandle
FDelegateHandle OnLoginQueueCancelledDelegateHandle
FAccelByteOnLoginQueueCanceledByUserDelegate OnLoginQueueCancelledDelegate
FDelegateHandle OnLoginQueueClaimTicketCompleteDelegateHandle
FAccelByteOnLoginQueueClaimTicketCompleteDelegate OnLoginQueueClaimTicketCompleteDelegate
Protected Attributes inherited from FOnlineAsyncTaskAccelByte
FOnlineSubsystemAccelByteWPtr AccelByteSubsystem
EAccelByteAsyncTaskState CurrentState = EAccelByteAsyncTaskState::Uninitialized
EAccelByteAsyncTaskCompleteState CompleteState = EAccelByteAsyncTaskCompleteState::Incomplete
EOnlineErrorResult TaskOnlineError = EOnlineErrorResult::Unknown
FString TaskErrorCode {}
FString TaskErrorStr {}
bool bShouldUseTimeout = false
double LastTaskUpdateInSeconds = FPlatformTime::Seconds()
double TaskTimeoutInSeconds = 30.0
double DeltaTickAccumulation = 0.0
FCriticalSection TimeoutLock
int32 LocalUserNum = INVALID_CONTROLLERID
FUniqueNetIdAccelByteUserPtr UserId = nullptr
int32 Flags = 0
TBitArray< FDefaultBitArrayAllocator > BitFlags
FOnlineAsyncTaskAccelByteParentTask = nullptr
FOnlineAsyncEpicTaskAccelByteEpic = nullptr
TSharedPtr< FAccelByteKey > LockKey

Additional Inherited Members

Protected Types inherited from FOnlineAsyncTaskAccelByte
using Super = FOnlineAsyncTaskAccelByte

Detailed Description

Async task to authenticate a user with the AccelByte backend, either using a native platform account, or a user specified account

Member Function Documentation

◆ GetTaskName()

virtual const FString FOnlineAsyncTaskAccelByteLogin::GetTaskName ( ) const
inlineoverrideprotectedvirtual

Basic method to get the current name of the task, used for ToString on tasks as well as trace logs.

Should be overridden by any async task that extends from this base class.

Reimplemented from FOnlineAsyncTaskAccelByte.

Reimplemented in FOnlineAsyncTaskAccelByteSimultaneousLogin.

◆ Initialize()

void FOnlineAsyncTaskAccelByteLogin::Initialize ( )
overridevirtual

Basic initialize override to check if we are using timeouts, and if so update the last task update time to the current time.

Reimplemented from FOnlineAsyncTaskAccelByte.

Reimplemented in FOnlineAsyncTaskAccelByteSimultaneousLogin.

◆ LoginWithNativeSubsystem()

void FOnlineAsyncTaskAccelByteLogin::LoginWithNativeSubsystem ( )
protected

Attempts to fire off a login request with a native subsystem, if one is set up and usable.

Parameters
LocalUserNumIndex of the user that we want to try and auth with native subsystem pass through
Returns
bool that is true if a native subsystem login was fired off, or false if not

◆ LoginWithSpecificSubsystem()

void FOnlineAsyncTaskAccelByteLogin::LoginWithSpecificSubsystem ( IOnlineSubsystem * NativeSubsystem)
protected

Attempts to fire off a login request with a specific subsystem, if one is set up and usable.

◆ OnLoginErrorOAuth()

void FOnlineAsyncTaskAccelByteLogin::OnLoginErrorOAuth ( int32 ErrorCode,
const FString & ErrorMessage,
const FErrorOAuthInfo & ErrorObject )
protected

Delegate handler for when any AccelByte login call fails.

Parameters
ErrorCodeCode returned from the backend representing the error that was encountered with the request
ErrorMessageMessage returned from the backend describing the error that was encountered with the request
ErrorObjectObject representing the error code that occurred

◆ OnLoginSuccess()

void FOnlineAsyncTaskAccelByteLogin::OnLoginSuccess ( )
protectedvirtual

Delegate handler for when any AccelByte login call succeeds.

◆ OnLoginSuccessV4()

void FOnlineAsyncTaskAccelByteLogin::OnLoginSuccessV4 ( const FAccelByteModelsLoginQueueTicketInfo & TicketInfo)
protectedvirtual

Delegate handler for when any AccelByte login v4 endpoints call succeeds.

◆ OnSpecificSubysystemLoginComplete()

void FOnlineAsyncTaskAccelByteLogin::OnSpecificSubysystemLoginComplete ( int32 LocalUserNum,
bool bWasSubsystemLoginSuccessful,
const FUniqueNetId & SubsystemUserId,
const FString & SubsystemError,
IOnlineSubsystem * SpecificSubsystem )
protectedvirtual

Callback for delegate fired when the specified subsystem has finished its authentication. Authenticates with the AccelByte back end upon firing.

Specific subsystem need to be passed to maintain consistency between LoginWithSpecificSubsystem() and the delegate

◆ OnSpecificSubysystemLoginUIClosed()

void FOnlineAsyncTaskAccelByteLogin::OnSpecificSubysystemLoginUIClosed ( FUniqueNetIdPtr UniqueId,
const int ControllerIndex,
const FOnlineError & SubsystemError,
IOnlineSubsystem * SpecificSubsystem )
protected

Callback for when the login UI for a specified platform subsystem is closed. Used to allow sign in with local user accounts on a specified subsystem and then subsequently login with the AccelByte back end. Passing in an extra LocalUserNum, as ControllerIndex is -1 if the call fails and we need to be able to inform that the login failed.

Specific subsystem need to be passed to maintain consistency between LoginWithSpecificSubsystem() and the delegate

◆ OnTaskTimedOut()

void FOnlineAsyncTaskAccelByteLogin::OnTaskTimedOut ( )
overridevirtual

Method called when this async task has timed out. Use to add custom timeout functionality.

Reimplemented from FOnlineAsyncTaskAccelByte.

◆ PerformLogin()

void FOnlineAsyncTaskAccelByteLogin::PerformLogin ( const FOnlineAccountCredentials & Credentials)
protectedvirtual

Perform login on the AccelByte backend using defined login type and OAuth error type

Reimplemented in FOnlineAsyncTaskAccelByteSimultaneousLogin.

◆ Tick()

void FOnlineAsyncTaskAccelByteLogin::Tick ( )
overrideprotectedvirtual

Simple tick override to check if we are using timeouts, and if so check the task timeout and complete the task unsuccessfully if it's over its timeout

Reimplemented from FOnlineAsyncTaskAccelByte.

Member Data Documentation

◆ Account

TSharedPtr<FUserOnlineAccountAccelByte> FOnlineAsyncTaskAccelByteLogin::Account
protected

Online user account for the user that we were able to login as

◆ AccountCredentials

FOnlineAccountCredentialsAccelByte FOnlineAsyncTaskAccelByteLogin::AccountCredentials
protected

Credentials of the account that we wish to login with

◆ bRetryLoginSkipExternalUI

bool FOnlineAsyncTaskAccelByteLogin::bRetryLoginSkipExternalUI {false}
protected

Flag if login by External UI is failed. It will retry the Native login and skip the login UI

◆ ErrorCode

int32 FOnlineAsyncTaskAccelByteLogin::ErrorCode
protected

Digit code representing the error that occurred

◆ ErrorOAuthObject

FErrorOAuthInfo FOnlineAsyncTaskAccelByteLogin::ErrorOAuthObject
protected

Object representing the error code that occurred

◆ ErrorStr

FString FOnlineAsyncTaskAccelByteLogin::ErrorStr
protected

String representing the error code that occurred

◆ LoginStatus

ELoginStatus::Type FOnlineAsyncTaskAccelByteLogin::LoginStatus = ELoginStatus::NotLoggedIn
protected

Login status for the user, should be NotLoggedIn, unless login succeeds fully

◆ LoginType

EAccelByteLoginType FOnlineAsyncTaskAccelByteLogin::LoginType
protected

Type of login that we wish to do on the backend