LoginWithJwt
method in Coherence.Cloud.CoherenceCloud
Methods
public static LoginOperation LoginWithJwt(string token, CancellationToken cancellationToken = default)
Login to coherence Cloud using a custom JSON Web Token (JWT).
Parameters
| Type | Name | Description |
|---|---|---|
| string | token | JSON Web Token (JWT) to log in with. Signed with an asymmetric algorithm (such as RS256 or ES256). Must contain a valid “sub” value which is the external unique player ID. |
| CancellationToken | cancellationToken | Used to cancel the operation. |
Returns
| Type | Description |
|---|---|
| LoginOperation | The status of the asynchronous login operation. |
Remarks
'JWT Auth Enabled' must be ticked and a 'JKU Domain' or 'Public Key' provided in Project Settings on your Online Dashboard for this authentication method to be usable.
Examples
using System.Threading.Tasks;
using Coherence.Cloud;
using UnityEngine;
class LoginWithJwt : MonoBehaviour
{
public async Task<PlayerAccount> Login(string token)
{
PlayerAccount playerAccount = await CoherenceCloud.LoginWithNintendo(token);
Debug.Log($"Logged in as: {playerAccount}.");
return playerAccount;
}
}