Prompt
Passwordless auth for web and mobile
Latest observation
Oct 28, 2026
OpenAI APIWeb search: off
Passwordless auth for web and mobile usually means letting users sign in without a traditional password, using one or more of these methods:
Common passwordless options
-
Magic link
- User enters email
- You send a one-time sign-in link
- Good for simplicity
- Downside: email deliverability and link-opening friction
-
One-time code / OTP
- User enters email or phone
- Receives a code to enter
- Good fallback option
- Downside: SMS is weaker and more expensive than email
-
Passkeys
- Uses device biometrics / secure hardware-backed keys
- Best security and UX when available
- Works well on modern web and mobile
- Recommended as the primary long-term approach
-
Social login
- Google / Apple / Microsoft
- Not truly passwordless in the purest sense, but often used as passwordless sign-in
- Good for reducing sign-up friction
Best approach for web + mobile
A strong modern setup is:
- Primary: Passkeys
- Fallback: Email magic link or OTP
- Optional: Google/Apple sign-in for convenience
This gives you:
- Great UX
- Strong security
- Coverage across devices
- A fallback for users who can’t use passkeys yet
Recommended architecture
On the backend
- Create a user record identified by email/phone/SSO subject
- Generate short-lived, one-time auth challenges
- Verify responses
- Issue your own session:
- Web: secure HTTP-only cookie
- Mobile: access token + refresh token, or secure session token stored in Keychain/Keystore
For passkeys
- Use WebAuthn / FIDO2 on web
- Use native passkey APIs on iOS and Android
- Store a credential ID/public key per user
- Verify signatures server-side
For magic links / OTP
- Generate a random token or code
- Store hashed token/code with expiry
- Mark it as single-use
- Send through email/SMS provider
- On verification, exchange for session
Security best practices
- Use short expiration for codes/links, e.g. 5–15 minutes
- Make tokens single-use
- Rate limit by IP, email, device, and account
- Detect abuse and brute force attempts
- Don’t expose whether an email/phone exists
- Use HTTPS everywhere
- Store mobile secrets in Keychain (iOS) and Keystore (Android)
- Prefer HTTP-only cookies for web sessions
- Support account recovery and device revocation
UX considerations
- Offer a clear sign-in choice:
- “Sign in with passkey”
- “Send me a magic link”
- “Use a code instead”
- On mobile, prefer native passkey flows
- On web, support QR-code handoff if needed for cross-device sign-in
- Provide a recovery path if email access is lost
If you want the simplest robust implementation
A practical stack is:
- WebAuthn/passkeys for modern devices
- Email magic links as fallback
- Session cookies for web
- JWT/refresh tokens for mobile
- Backend in any framework with secure token storage and verification
If you want, I can also give you:
- a full system design,
- a database schema, or
- sample implementation for React + iOS/Android + Node/Go/Python.