Prompt
How do I build passwordless sign-in for a web app with iOS and Android support?
Latest observation
A good way to build passwordless sign-in for a web app with iOS and Android support is to use passkeys as your primary method.
Passkeys are based on WebAuthn / FIDO2 and let users sign in with:
- Face ID / Touch ID on iPhone and iPad
- Fingerprint / device PIN on Android
- Built-in platform authenticator on the web
They’re phish-resistant and much better than SMS or email magic links as a primary auth method.
Recommended approach
1) Use passkeys as the main login method
Support:
- Registration: user creates a passkey
- Authentication: user signs in with the passkey
- Account recovery: provide fallback options in case they lose devices
2) Keep a fallback path
Even with passkeys, you should usually offer one or more backup methods:
- Email magic link
- Recovery codes
- Existing session on another device
- Customer support recovery flow
Avoid relying only on SMS for recovery if you can.
High-level architecture
Client
- Web app using WebAuthn API
- iOS and Android users can sign in through:
- the browser on mobile
- native apps if you have them, using platform auth libraries or an embedded web flow
Server
- User account store
- Passkey credential store
- WebAuthn challenge generation and verification
- Session/token issuance after successful auth
Core flows
A. Sign-up / passkey registration
- User enters email or chooses “Create passkey”
- Server creates a registration challenge
- Client calls
navigator.credentials.create(...) - User authenticates with Face ID / Touch ID / fingerprint / device PIN
- Client sends attestation/credential response to server
- Server verifies the response and stores:
- credential ID
- public key
- sign count / related metadata
- user ID
Important
Use user verification required where possible, and store a unique credential per account/device.
B. Sign-in / authentication
- User enters email or chooses “Sign in with passkey”
- Server creates an authentication challenge
- Client calls
navigator.credentials.get(...) - Platform authenticates the user
- Client returns assertion to server
- Server verifies signature and challenge
- Server creates a session or issues JWT/OAuth tokens
Mobile support details
iOS
- Passkeys work well in Safari and supported browsers via WebAuthn
- If you have a native iOS app, use Apple-supported passkey APIs or an auth library that wraps platform authenticators
- iCloud Keychain can sync passkeys across Apple devices
Android
- Passkeys work in Chrome and supported browsers
- Android Credential Manager / Google Password Manager can store and sync passkeys
- Native apps can use platform credential APIs
Cross-device sign-in
Users can authenticate on one device by scanning a QR code or using nearby device flows, depending on your implementation and platform support.
Security best practices
- Always use HTTPS
- Use WebAuthn challenges that are:
- random
- single-use
- short-lived
- Bind challenges to the session/user intent
- Verify:
- origin
- RP ID
- challenge
- signature
- user presence/user verification
- Store credentials securely
- Support account management:
- list passkeys
- rename devices
- revoke lost devices
UX recommendations
- Let users sign in with email + passkey
- Show a clear fallback if the passkey isn’t available
- Add “Remember this device” only if you understand the security tradeoffs
- Offer passkey creation after password login for gradual migration
- Explain benefits simply:
- “No password to remember”
- “Faster sign-in”
- “Works with Face ID / fingerprint”
If you’re building from scratch, use an auth library
You’ll save a lot of time using a library/provider that already supports passkeys/WebAuthn, such as:
- Auth.js / NextAuth with WebAuthn support via plugins/integration
- SimpleWebAuthn for direct implementation
- Managed auth providers that support passkeys
Direct implementation is possible, but the verification logic is easy to get subtly wrong.
Suggested implementation stack
Frontend
- React / Next.js / Vue / Svelte
- WebAuthn browser APIs
- Optional native mobile app with platform auth APIs
Backend
- Node.js, Go, Python, Java, etc.
- WebAuthn server library
- DB tables for users and credentials
- Session management
Database tables
userswebauthn_credentialsiduser_idcredential_idpublic_keycountertransportscreated_atlast_used_at
Minimal product decision
If you want the simplest robust setup:
- Use email as the identifier
- Let users create passkeys
- Use passkey sign-in by default
- Keep email magic link as backup
- Add recovery codes
That gives you a solid passwordless experience without locking users out.
If you want, I can also provide:
- a step-by-step implementation guide
- sample server/client code for WebAuthn
- an example using Next.js + Node
- guidance for native iOS/Android apps