/
AuthenticateWithPassword (Unity)
AuthenticateWithPassword (Unity)
- Declaration
public static void AuthenticateWithPassword(string server, string email, string password, Action<CavrnusAuthentication> onSuccess, Action<string> onFailure)
- Description
Gets user credentials, allowing you to join valid spaces and make other requests.
onFailure
will generally trigger if the user's email or password is invalid, or if they are not connecting to a valid server.
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 TMPro;
using UnityEngine;
public class AuthenticateWithPassword : MonoBehaviour
{
public TMP_InputField UserEmailInput;
public TMP_InputField UserPasswordInput;
private const string MyServer = "cavrnus.cavrn.us";
public void Authenticate()
{
CavrnusFunctionLibrary.AuthenticateWithPassword(MyServer, UserEmailInput.text, UserPasswordInput.text,
auth => OnAuthComplete(auth), error => OnAuthFailure(error));
}
private void OnAuthComplete(CavrnusAuthentication auth)
{
Debug.Log("Authentication complete! Welcome to Cavrnus!");
}
//Generally an invalid email or password
private void OnAuthFailure(string error)
{
Debug.LogError("Failed to login: " + error);
}
}
, multiple selections available,
Related content
AuthenticateWithPassword (Unreal Engine)
AuthenticateWithPassword (Unreal Engine)
More like this
JoinSpace (Unreal Engine)
JoinSpace (Unreal Engine)
Read with this
AuthenticateAsGuest
AuthenticateAsGuest
More like this
DefineXPropertyDefaultValue (Unreal Engine)
DefineXPropertyDefaultValue (Unreal Engine)
Read with this
authenticateWithPassword (Javascript)
authenticateWithPassword (Javascript)
More like this
FetchJoinableSpaces (Unreal Engine)
FetchJoinableSpaces (Unreal Engine)
Read with this