Skip to main content
Beta

This feature is in beta. Core behavior is stable, but some APIs or configuration may change before general availability.

Authentication

JavaScriptDartSwiftKotlinJavaScalaPythonGoPHPRustC#C++RubyElixir

EdgeBase Authentication provides a complete identity solution for your applications. Support email/password, magic link, email OTP, passkeys, phone auth, 14 OAuth providers, anonymous sessions, and MFA out of the box. Sessions are managed via JWT with automatic refresh token rotation, and you can extend every step of the auth flow with backend authentication triggers and delivery hooks.


Control Surface

Auth Methods

📧

Email & Password

PBKDF2 hashing (100K iterations), email verification support

Magic Link

Passwordless email login — click a link, no password needed

🔢

Email OTP

6-digit passwordless codes delivered by email

🌐

OAuth

Google, GitHub, Apple, Discord, and 10 more providers

🪪

Passkeys

WebAuthn login with biometrics and security keys

📱

Phone / SMS

OTP-based phone login — verify identity with a 6-digit SMS code

👤

Anonymous

Instant sign-in with no credentials — upgradeable to full account later

🔐

Multi-Factor Auth

TOTP-based 2FA with recovery codes for extra account security

How Sessions Work

Session Lifecycle
Sign In → Access Token (15 min) + Refresh Token (28 days)
              │
              ▼
     Token expires → SDK auto-refreshes using Refresh Token
              │
              ▼
     New Access Token + New Refresh Token (rotation)
  • Access Token — Short-lived JWT verified locally (no server round-trip)
  • Refresh Token — Long-lived, single-use with rotation grace period for concurrent requests
  • Multi-tab sync — Token refresh broadcasts across browser tabs via BroadcastChannel

Quick Example

Assume client is already initialized with your platform SDK.

const signUpResult = await client.auth.signUp({
email: 'user@example.com',
password: 'securePassword123',
});

const session = await client.auth.signIn({
email: 'user@example.com',
password: 'securePassword123',
});

const currentUser = client.auth.currentUser;

client.auth.onAuthStateChange((event, nextUser) => {
console.log(event, nextUser?.email);
});

Custom Claims

Attach custom data to user tokens for role-based access:

// Server-side: set custom claims
await admin.auth.setCustomClaims(userId, {
role: 'editor',
plan: 'pro',
});

// Use in access rules:
// access: { update(auth) { return auth?.custom?.role === 'editor' } }
Server-Side Auth Coverage

Admin user management, session revocation, and authentication trigger integrations are available across all Admin SDKs.

Next Steps

📧
Email & Password

Sign up, sign in, password reset, email verification

Magic Link

Passwordless email login — no password required

🔢
Email OTP

6-digit passwordless codes sent by email

🌐
OAuth

Social login with 14 providers

🏢
OIDC Federation

Connect Okta, Auth0, Keycloak, and other OIDC providers

📱
Phone / SMS

OTP-based phone login with SMS verification

👤
Anonymous Auth

Zero-friction sign-in, account upgrading

🪪
Passkeys

WebAuthn sign-in and passkey management

🔐
Multi-Factor Auth

TOTP-based 2FA with recovery codes

🔑
Sessions

JWT lifecycle, refresh rotation, multi-tab sync

📨
Email Change

Two-step verified email updates for signed-in users

👨‍💼
Admin Users

Server-side user management

Ban & Disable

Lock out compromised or abusive accounts

📥
User Import

Bulk import existing users and credentials

🔒
Access Rules

Allow or deny auth actions such as sign-up, sign-in, MFA, OAuth, refresh, and sign-out

🪝
Authentication Triggers

Run server-side logic during sign-up, sign-in, token refresh, and more

📨
Authentication Delivery Hooks

Rewrite or block outbound auth email and SMS messages

🤖
Captcha

Turnstile integration for bot protection

🔗
Account Linking

Upgrade anonymous accounts or attach multiple OAuth providers to one user

⚠️
Error Codes

Complete auth error reference

🔒
Password Policy

Strength rules, HIBP leak detection, hashing

📋
Session Management

Session limits, eviction, token rotation, cleanup

🧭
SDK Support

See which auth capabilities belong to Client SDK vs Admin SDK