Auth Implementation suggestions
Answered
Param san posted this in #help-forum
I am looking for the best and simplest to implement auth in Nextjs 13 site with App router, please give me your suggestions.
Thank you
Thank you
12 Replies
Northern Wheatear
The best way with nextjs is to use NextAuth
Northern Wheatear
Answer
@Northern Wheatear The best way with nextjs is to use NextAuth
Does it integrate well with DynamoDB?
And other DBs like Supabase and MongoDb?
Northern Wheatear
Are you trying to store session tokens in a DB or with JWT
If you are using DB to store session tokens there are some DB adapters available for it... And its relatively simple to integrate
Check this out https://next-auth.js.org/adapters
@Northern Wheatear If you are using DB to store session tokens there are some DB adapters available for it... And its relatively simple to integrate
What would you recommend? Using session tokens or JWT?
For a simple SaaS use case
Northern Wheatear
JWT is the easiest way to implement authentication but with with session tokens we can have more control on the user's authentication status. Like implementing logging out of all devices
You can start with JWT... And if required you can later transition to session auth
As you say master 🫡, Thanks for the guidance.