Skip to main content
The Authentication component handles login dialogs, session state, and token management. All other components depend on a valid auth state.

Login strategies

Authentication Required (default): The login dialog opens automatically when PlaytoliaGameObject initializes. This strategy is best for games that require login from the start. Manual: Disable “Authentication Required” under Playtolia → Features in Project Settings. Then call PromptLogin() at the moment that you select, for example after a tutorial or at a gated feature.

Prompting login

Non-dismissable dialogs block all touch input on the game scene behind them.

Listening to auth state

Always remove the listeners in OnDestroy. If you do not remove them, the callbacks run on destroyed objects.

Reading the auth state

The SDK refreshes the tokens automatically in the background. You do not have to handle token expiry.

Logout

Authentication providers

Enable each provider under Playtolia → Features in Project Settings: Google, Facebook, Apple (required on iOS), Discord, Email/Password, and Guest.

Password reset

The login overlay handles password reset without any code in your game. A player who taps FORGOT PASSWORD enters their email, receives a one-time code, and sets a new password in the overlay. The backend decides how the code behaves, and the overlay follows it:
  • Code length. The number of digit boxes comes from the server response, not from a constant in the SDK. If your team changes the code length in the backend, players see the new length without a game update. When the server sends no length, the overlay asks for 6 digits.
  • Validity. The countdown under the digit boxes is the real lifetime of the code, as reported by the server. When it reaches zero, the overlay tells the player the code expired and blocks the confirm button.
  • Resend. A RESEND CODE button sends a new code and restarts both countdowns. The button stays disabled during a cooldown. If the server rejects a request as too early, the overlay uses the wait time from the server response for the countdown.
The same rules apply to the email verification code, because both codes come from the same backend contract.
The sign-up screen shows a consent line with Terms of Service and Privacy Policy labels next to the acknowledgment checkbox. Set the destinations under Legal on the Playtolia → Features page:
  • Terms of Service URL
  • Privacy Policy URL
If you leave a field empty, the SDK shows that label as plain text that the player cannot tap. If you give a URL, the label becomes a link that opens in the device browser. At startup, the SDK also loads the public metadata of the game from Playtolia. If the API returns a non-null value, a Terms of Service URL or a Privacy Policy URL from the Playtolia dashboard replaces the Unity setting. If persistence is on, the SDK caches the most recent game metadata on the device. Thus the dashboard URLs stay available while the game is offline. If the API never succeeded, or a URL is null, the SDK uses the Unity setting.

Account Management

Access user profile data after login