DEV Community

Cover image for 🔑 Passwordless Authentication with Next.js, Prisma, and next-auth

🔑 Passwordless Authentication with Next.js, Prisma, and next-auth

hexrcs on September 26, 2020

Passwordless Authentication with Next.js, Prisma, and next-auth In this post, you'll learn how to add passwordless authentication to you...
Collapse
 
epavanello profile image
Emanuele Pavanello

I started to use prisma and seems good, thanks for this post! 💪🏻

Collapse
 
hexrcs profile image
hexrcs

You are welcome, hope you found this tutorial useful! 👍

Have you joined the Prisma Slack channel? If you encountered any problem with Prisma, feel free to post it there!

Collapse
 
epavanello profile image
Emanuele Pavanello

I didn’t know this channel, thank you very much 👍🏻

Collapse
 
vmariano profile image
Don Vicente

Hey, I know this tutorial already has 3 years, probalby requiere an update since next-auth, change table names of how they store the session.

In another topic, I don't understand why is requiere to add an OAuth provider on Step 3.1. Can you explain why is requiere if is this solution is "passwordless" ?

Collapse
 
kubrafelek profile image
Kübra Felek

Hi, I wanna curios something. Can we use Prisma and UpstashRedis adapter at the same time in NextJs? I'm using Prisma Adapter and also user sessions in redis but I cannot do that in NextJs. Do you have any idea or comment for that ?
Thanks :)

Collapse
 
garytube profile image
Gary

how would I add new columns to the user model? the offical documentation is not very helpfule.

i want to extend the users schema with user roles for authz

Collapse
 
thebiglabasky profile image
Hervé Labas

Hi Gary,
While it's still experimental, and will be updated in the coming weeks, you can use Prisma migrate to do that.
Update your schema with the columns you need, run migrate (or db push if you don't need to keep and share the history of your schema migrations)
The docs about that are here: prisma.io/docs/reference/tools-and...
Hope it helps!

Collapse
 
tomgroombridge profile image
Tom Groombridge

Great post thank you very much.

I am struggling with integrating this into my cypress tests. Do you have a post for this? If not can I suggest one please.

Collapse
 
lc_carrier profile image
LC Carrier

Awesome tutorial. Any way you can expand and do an example with email/password combination? Thanks

Collapse
 
g4ndy profile image
g4ndy

Thank you for very nice tutorial!
I believe the DATABASE_URL no longer needs to be recorded into root .env file since Prisma takes it from its own .env

Collapse
 
spsaucierbakkt profile image
Stevo

So, uh.. doesn't this allow anyone with an email address to log into the app? Where is the user/email whitelist?