Class AuthClient
public class AuthClient : IAuthClient
- Inheritance
-
AuthClient
- Implements
Constructors
AuthClient(string, bool, string, IRequestFactory)
public AuthClient(string uniqueId, bool autoLoginAsGuest, string projectId, IRequestFactory requestFactory)
Parameters
uniqueId
stringautoLoginAsGuest
boolprojectId
stringrequestFactory
IRequestFactory
Properties
GuestPassword
public string GuestPassword { get; }
Property Value
LoggedIn
public bool LoggedIn { get; }
Property Value
SessionToken
public string SessionToken { get; }
Property Value
SessionTokenRefreshResult
public Result? SessionTokenRefreshResult { get; }
Property Value
UserId
public string UserId { get; }
Property Value
UserName
public string UserName { get; }
Property Value
Methods
Dispose()
public void Dispose()
LoginAsGuest()
Login with a Guest Account to the coherence Cloud.
public Task<Result> LoginAsGuest()
Returns
LoginWithPassword(string, string, bool)
Login with a specific account to the coherence Cloud. This requires Persistent Accounts to be enabled in your coherence Dashboard.
public Task<Result> LoginWithPassword(string userNameParam, string password, bool autoSignup)
Parameters
userNameParam
stringUsername for the account.
password
stringPassword for the account.
autoSignup
boolIf the account doesn't exist, it will be created.
Returns
Logout()
Clear the cached Login credentials and be considered as logged out from the coherence Cloud.
public void Logout()
Events
OnConcurrentConnection
Server push message that will be sent when your connection to the coherence Cloud has been forcefully closed. Usually this happens when a concurrent connection is detected, e.g. running multiple game clients for the same player. When this happens the game should present a prompt to the player to inform them that there is another instance of the game running. The game should wait for player input and never try to reconnect on its own or else the two game clients would disconnect each other indefinitely.
public event Action<ConnectionClosedResponse> OnConcurrentConnection
Event Type
OnLogin
public event Action<LoginResponse> OnLogin
Event Type
OnLogout
public event Action OnLogout
Event Type
OnSessionRefreshed
Wait for the AuthClient to check if it is able to refresh a previously cached Session Token. This method should always be used before attempting to log in manually.
public event Action<Result> OnSessionRefreshed