AuthenticateAsGuest

- Declaration

public static void AuthenticateAsGuest(string server, string userName, Action<CavrnusAuthentication> onSuccess, Action<string> onFailure)

- Description

Creates a guest user account with a given name and joins as that user.

This is a good way of immediately getting your customers into a space without requiring any inputs from them.

Keep in mind that Guest accounts have limited permissions, which can be customized in the Management Console.

onFailure generally shouldn’t trigger outside of rare cases.

onSuccess provides a CavrnusAuthentication which you can then store/load on your local machine to use on a future run without requiring the user to re-login.

- Sample

using CavrnusSdk.API; using UnityEngine; public class AuthenticateAsGuest : MonoBehaviour { private const string MyServer = "cavrnus.cavrn.us"; void Start() { CavrnusFunctionLibrary.AuthenticateAsGuest(MyServer, "Cavrnus Guest User", auth => OnAuthComplete(auth), error => OnAuthFailure(error)); } private void OnAuthComplete(CavrnusAuthentication auth) { Debug.Log("Authentication complete! Welcome to Cavrnus!"); } private void OnAuthFailure(string error) { Debug.LogError("Failed to login: " + error); } }