Next.js Discord

Discord Forum

Connect Next-Auth with postgresql

Answered
Scaly-naped Pigeon posted this in #help-forum
Open in Discord
Scaly-naped PigeonOP
I checked the documentation and saw that i have to add something like this

database: "postgres://username:password@127.0.0.1:5432/database_name"

but where should i add it to be able to let the user login to my website using next-auth

18 Replies

You can use an ORM like prisma
@SharpieMaster You can use an ORM like prisma
Scaly-naped PigeonOP
so I must use prisma , is there any way to just use database and let it connect to something like normal login ?
@Scaly-naped Pigeon so I must use prisma , is there any way to just use database and let it connect to something like normal login ?
No well, nextauth will handle all the registration and session handling
I dont think there is a way to use raw queries
Actually
Wajt
@Clown Use a adapter
Scaly-naped PigeonOP
I know how to connect to mongodb but I wanted to use postgres into this project but I am not sure where to add inside adapter to be able to use it
Wait..
There is a postgres adapter too
:pikachu_shocked:
Scaly-naped PigeonOP
oh that would be so cool to use, i tried to search for one but didn't find anything 😅
Answer
Try and use it. I don't know how well it will integrate but well, setting this up shouldn't take more than 15 mins
(btw authjs is kinda what nextAuth future is)
@Clown https://authjs.dev/reference/adapter/pg
Scaly-naped PigeonOP
Thank you so much, I didn't know that Its my first time using next-auth , will try to implement it and see how it works ^^
@Clown Mark the solution 👍
Scaly-naped PigeonOP
done, thank you man ♥