Auth
Email/password, magic link, OAuth, phone OTP, MFA, SAML SSO, CAPTCHA, refresh sessions, and Auth Studio.
Email & password
index.ts
const { data, error } = await voltbase.auth.signUp({
email: 'you@example.com',
password: 'secret',
options: { captchaToken }, // when Protection is enabled
});
const { data: session, error: signInError } = await voltbase.auth.signIn({
email: 'you@example.com',
password: 'secret',
});
// If MFA is enrolled: session.next === 'mfa'Magic link
index.ts
await voltbase.auth.sendMagicLink('you@example.com', {
redirectTo: 'https://app.example.com/welcome',
});
// Opens siteUrl (or redirectTo) with access_token + refresh_tokenOAuth
Providers: Google, GitHub, Discord, Apple, Azure, Twitter/X. Configure in Auth → Providers, then:
index.ts
voltbase.auth.signInWithOAuth({ provider: 'discord' });
// Legacy helpers still work:
voltbase.auth.signInWithGoogle();
voltbase.auth.signInWithGithub();Phone OTP
Requires AgooSMS credentials in Auth → Phone (docs).
index.ts
await voltbase.auth.signInWithOtp({ phone: '+15551234567' });
const { data, error } = await voltbase.auth.verifyOtp({
phone: '+15551234567',
token: '123456',
type: 'sms',
});MFA (TOTP)
index.ts
const { data: factor } = await voltbase.auth.mfa.enroll({ factorType: 'totp' });
// Show factor.totp.qr_code, then confirm:
await voltbase.auth.mfa.verifyEnroll({
factorId: factor.id,
code: '123456',
});
// After password sign-in when next === 'mfa':
const { data: challenge } = await voltbase.auth.mfa.challenge({ factorId: factor.id });
await voltbase.auth.mfa.verify({
challengeId: challenge.id,
code: '123456',
});
// Session aal upgrades to aal2Recovery codes
verifyEnroll returns one-time recovery codes — store them securely. They can be used in place of a TOTP code during mfa.verify.SAML SSO
index.ts
voltbase.auth.signInWithSSO({ domain: 'acme.com' });CAPTCHA
Enable Cloudflare Turnstile (or hCaptcha) under Auth → Protection. Pass captchaToken on signup, signin, magic link, OTP, and password reset.
Verify & reset
index.ts
await voltbase.auth.resendVerification('you@example.com');
await voltbase.auth.resetPasswordForEmail('you@example.com');
await voltbase.auth.updatePassword({ token: '…', password: 'new-secret' });Session & refresh
index.ts
voltbase.auth.getSession(); // includes refreshToken + aal
await voltbase.auth.refreshSession(); // automatic before access expiry
voltbase.auth.signOut();
voltbase.auth.onAuthStateChange((event, session) => {
// SIGNED_IN | TOKEN_REFRESHED | SIGNED_OUT | INITIAL_SESSION
});Auth Studio
Dashboard Auth includes Users admin (invite/ban/JWT inspector), Provider wizards, Phone, URL allowlist, Email templates, MFA policy, SSO IdPs, CAPTCHA Protection, and Hooks (beforeUserCreated / customAccessToken → Edge Functions).