how to do a passwordless login
We collect the user email and then send OTP to the mail address. How can we do that
3 Replies
What are you using for authentication? NextAuth?
Easiest one with NextAuth would be https://next-auth.js.org/providers/email where user only needs to enter their email address and they would get magic link that works one time for login. Bit better than OTP as you dont have to type it.
But if you still feel like to generate OTP and ask user to enter here is comment on nextauth issue that describes how to do it
https://github.com/nextauthjs/next-auth/issues/709#issuecomment-784077142
Email | NextAuth.js
Overview
GitHub
Magic Passcode · Issue #709 · nextauthjs/next-auth
Your question I'm curious if there's currently a way to have the same behavior as the magic link, but instead send a 4-6 digit code to their email that the user can then enter in themselves...
Thanks manh I'll check this