Prompt
Can I add passwordless login without changing my user database?
Latest observation
Yes — in many cases you can add passwordless login without changing your existing user database schema.
Common ways to do it
1) Use a separate passwordless/auth table
Keep your current users table unchanged and add a new table for one-time login data, for example:
emailtokenexpires_atused_atpurpose(login, reset, etc.)
This is the most common approach if you want to avoid touching your user model.
2) Store passwordless state in an external identity provider
Use a service like:
- Auth0
- Clerk
- Firebase Auth
- Supabase Auth
- Cognito
In this setup, your app keeps its current user DB, but authentication is handled externally. You map the authenticated identity back to your existing user records using email or an external ID.
3) Use magic links or OTPs without schema changes
If your login method is:
- email magic links
- SMS OTP
- email OTP
you can often implement it by storing temporary auth data in:
- Redis
- a cache
- a separate auth/session store
- JWTs with short lifetimes
So your main user table doesn’t need modification.
When you might still need some change
You may need a small change if your app currently lacks:
- a unique email/username field to identify users
- a place to link an external auth identity
- a way to record “last login” or audit info
But these are often optional, not required for basic passwordless login.
Best practice
If you want minimal disruption, the safest pattern is:
- Keep your existing user table as-is
- Add a separate passwordless token/session store
- Verify the token
- Look up the user by email or existing identifier
- Create a normal app session after login
Bottom line
Yes, you usually can. The cleanest options are:
- separate token/session storage, or
- an external auth provider
If you want, I can sketch a simple passwordless login flow that works with your current schema.