Guest Mode
Use the OnSignUpGuest
method from the Openfort SDK to create a guest account:
public async void OnSignUpGuest()
{
loadingPanel.SetActive(true);
registerButton.interactable = false;
statusTextLabel.text = quot;Logging In As Guest ...";
try
{
AuthResponse authResponse = await openfort.auth.signUpGuest();
accessToken = authResponse.Token;
await SetAutomaticRecoveryMethod();
loginPanel.SetActive(false);
statusTextLabel.text = quot;Logged In As Guest";
loggedinPanel.SetActive(true);
}
catch (System.Exception)
{
loginPanel.SetActive(false);
registerPanel.SetActive(true);
}
signinButton.interactable = true;
loadingPanel.SetActive(false);
}
Upon successful registration, you'll receive a response containing the user information and authentication tokens:
{
"player": {
"id": "pla_...",
"object": "player",
"createdAt": 1234567890,
"linkedAccounts": []
},
"token": "eyJhbG...",
"refreshToken": "eyJhbG..."
}
Upgrade a guest user to a logged-in user
Simply call link method to enable the guest user to upgrade their account to a logged-in account using any authentication method of their choice.