LoginWithPassword
method in Coherence.Cloud.CoherenceCloud
Methods
public static LoginOperation LoginWithPassword(string username, string password, bool autoSignup = false, CancellationToken cancellationToken = default)
Login to coherence Cloud using a username and password.
Parameters
| Type | Name | Description |
|---|---|---|
| string | username | Username for the player account to log into. |
| string | password | Password for the player account to log into. |
| bool | autoSignup | Should a new player account with the provided |
| CancellationToken | cancellationToken | Used to cancel the operation. |
Returns
| Type | Description |
|---|---|
| LoginOperation | The status of the asynchronous login operation. |
Remarks
'User / Password Auth Enabled' must be ticked in Project Settings on your Online Dashboard for this authentication method to be usable.
Examples
using Coherence.Cloud;
using UnityEngine;
class LoginWithPassword : MonoBehaviour
{
[SerializeField] string username;
[SerializeField] string password;
[SerializeField] bool autoSignup;
public PlayerAccount PlayerAccount { get; private set; }
async void Start()
{
PlayerAccount = await CoherenceCloud.LoginWithPassword(username, password, autoSignup);
Debug.Log($"Logged in as: {PlayerAccount}.");
}
}