App Auth (End-Users)
How end-users sign in to your generated apps. Three first-class methods: Google Sign-In, email + password, and magic link. Same session model across all of them.
Auth Methods
Your generated app can authenticate end-users with any combination of:
Google Sign-In
Zero-config OAuth flow. Fastest for users who already have a Google account.
Email + Password
Classic signup / login with bcrypt-hashed passwords. OTP confirms email before account is created.
Magic Link
Passwordless. User receives an email with a one-time link that signs them in.
Google Sign-In
GenMB hosts the OAuth client and callback. You do not need to register a project in Google Cloud or copy a client secret.
await window.genmb.auth.signIn() // opens Google popup, returns when done
const user = window.genmb.auth.getUser() // { id, email, name, avatarUrl } or null
await window.genmb.auth.signOut()Email + Password
Sign up requested
OTP verified
appUsers/{appId}~{email} and a session cookie is set.Subsequent logins
Forgot password
Magic Link
The simplest UX. User enters an email and clicks the link in the message GenMB sends. The SDK auto-verifies the token on page load via ?magic_token=... and the user is signed in.
await window.genmb.auth.sendMagicLink({ email: 'user@example.com' })
// User clicks email link; redirected back signed in.SDK Usage
All methods funnel into a unified window.genmb.auth object so your UI code does not need to branch on method:
window.genmb.auth.getUser() // current user or null
window.genmb.auth.onChange(user => {}) // subscribe to sign-in / sign-out
await window.genmb.auth.signOut() // works for any methodCombine with RBAC to gate features by role, and with app data to scope records to user.id.
Sessions
Sessions live server-side in appAuthSessions and are referenced from a genmb_auth_session cookie scoped to your app domain. The cookie is HttpOnly and Secure; you cannot read it from JavaScript.
Limits
- Magic-link rate limit: 3 sends per email+app per 15-minute window, 10 per IP.
- OTP TTL: 15 minutes.
- Staged signup blob TTL: 15 minutes.
- Origin validation: only your deployed app domain can call the auth endpoints (CORS preflight enforced).
- Available on all plans, including Free.
FAQs
How is this different from the auth I use to sign into GenMB?▾
Which auth method should I pick?▾
Can I use more than one method in the same app?▾
Where do sessions live?▾
Are passwords stored safely?▾
Ready to build?
Create your first app for free, no credit card required.