Docs
/Docs
Ctrl K
GitHubDashboard
IntroductionQuick StartInstallationConfigurationSelf-Hosting Guide
Unity SDK(soon)
Unreal SDK(soon)
Godot SDK(soon)
Web SDK
Mobile SDKs(soon)
Authentication(soon)
Player DataCloud Save
Leaderboards(soon)
Economy
Analytics(soon)
Remote Config
Push Notifications(soon)
Friends and Social(soon)
AB Testing(soon)
Player Segments(soon)
REST API
Authentication(soon)
Error CodesRate Limits
Webhooks(soon)
Migrating from Other Services(soon)
Best Practices(soon)
Security(soon)
Testing(soon)

Need help?

Join our Discord community for support and updates.

Join Discord
Docs/Services/Authentication

Authentication

Secure and scalable player authentication for Ondara.

All authentication is handled securely on our servers. Passwords are hashed with bcrypt and tokens are signed with RS256. We never store plaintext credentials.

Supported Providers

Anonymous

Available

Quick sign-in without credentials. Perfect for testing or guest play.

Email/Password

Available

Traditional email and password authentication with verification.

G

Google

Available

Sign in with Google accounts using OAuth 2.0.

Apple

Available

Sign in with Apple for iOS and macOS apps.

S

Steam

Available

Authenticate using Steam accounts for PC games.

Custom

Available

Bring your own identity provider with JWT tokens.

Code Examples

1// Anonymous login - creates a new player or returns existing
2var player = await Ondara.Auth.LoginAnonymous();
3
4// The player ID persists across sessions
5Debug.Log($"Player ID: {player.Id}");
6
7// You can upgrade anonymous accounts later
8await Ondara.Auth.LinkEmail("email@example.com", "password");

Account Linking

Players can link multiple auth providers to a single account. This lets them start as anonymous and later add email or social login without losing progress.

1// Link email to existing account
2await Ondara.Auth.LinkEmail("email@example.com", "password");
3
4// Link Google account
5await Ondara.Auth.LinkGoogle();
6
7// Unlink a provider (must have at least one remaining)
8await Ondara.Auth.UnlinkProvider("google");
9
10// Get all linked providers
11var providers = Ondara.Auth.CurrentPlayer.Providers;
12foreach (var provider in providers)
13{
14 Debug.Log($"Linked: {provider.Type}");
15}

Session Management

Automatic Session Handling
Sessions are automatically refreshed. Players stay logged in across app restarts.
1// Check if player is logged in
2if (Ondara.Auth.IsLoggedIn)
3{
4 var player = Ondara.Auth.CurrentPlayer;
5 Debug.Log($"Welcome back, {player.DisplayName}!");
6}
7
8// Listen for auth state changes
9Ondara.Auth.OnAuthStateChanged += (player) =>
10{
11 if (player != null)
12 Debug.Log("Player logged in");
13 else
14 Debug.Log("Player logged out");
15};
16
17// Logout
18await Ondara.Auth.Logout();

Best Practices

  • Start with Anonymous Auth

    Let players try your game immediately, then prompt them to create an account later.

  • Handle Auth Errors Gracefully

    Always wrap auth calls in try/catch and show user-friendly error messages.

  • Offer Multiple Providers

    Different players prefer different login methods. Support at least 2-3 options.

Player DataCloud Save