Authentication in Next.js

  Kiến thức lập trình

I want to add different kinds of authentication in my Next.js project. What should I use for it? Next/Auth or Firebase or something else? According to my knowledge, Next/Auth doesn’t provide any direct authentication method by email & password. We need to save the user in the backend first, then we have to match the user’s email & password with the database, and then we can log in by using Next/Auth Credentials Provider. But is there any simple and efficient way for the authentication that I can use in my Next.js project just like firebase? **

If yes, then please share with me with proper documentation.

**

Isn’t this the simplest way to do authentication? If you look at the steps you mentioned:-

  1. Store user in a database (which you have to do regardless)
  2. Match email and password with the database (again, you have to do this regardless)

Since Next.js is an highly opinionated framework, using Next/Auth is a better option rather than opting for any other service. In the end, it doesn’t matter much, apart from that in firebase, you have to setup a completely different service and maintain that too. Go for Next/Auth in my opinion.

You can also opt for Authentication SAAS like Clerk or something else, they are essentially firebase, but only solving Authentication and have a great compatibility with Nextjs

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT