Table of Contents

Class AuthClient

Namespace
Coherence.Cloud
Assembly
Coherence.Runtime.dll
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 string
autoLoginAsGuest bool
projectId string
requestFactory IRequestFactory

Properties

GuestPassword

public string GuestPassword { get; }

Property Value

string

LoggedIn

public bool LoggedIn { get; }

Property Value

bool

SessionToken

public string SessionToken { get; }

Property Value

string

SessionTokenRefreshResult

public Result? SessionTokenRefreshResult { get; }

Property Value

Result?

UserId

public string UserId { get; }

Property Value

string

UserName

public string UserName { get; }

Property Value

string

Methods

Dispose()

public void Dispose()

LoginAsGuest()

Login with a Guest Account to the coherence Cloud.

public Task<Result> LoginAsGuest()

Returns

Task<Result>

Result of the Login operation.

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 string

Username for the account.

password string

Password for the account.

autoSignup bool

If the account doesn't exist, it will be created.

Returns

Task<Result>

Result of the Login operation.

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

Action<ConnectionClosedResponse>

OnLogin

public event Action<LoginResponse> OnLogin

Event Type

Action<LoginResponse>

OnLogout

public event Action OnLogout

Event Type

Action

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

Event Type

Action<Result>

Returns Result.Success if the current Session Token was successfully refresh, it returns Result.InvalidCredentials if you have to log in manually again.l