Suggested authentication library
Authentication solutions vary based on your requirements and resources. If you need full control over user data, you might consider self-hosted options like NextAuth (now Auth.js) or Better Auth. For those who prefer managed solutions, providers like Clerk or Auth0 offer hosted alternatives.
Handling sensitive user data, such as passwords, requires strict adherence to security best practices. Refer to the OWASP Password Storage Cheat Sheet to ensure secure implementation.
Authentication Solutions
This section lists our suggested libraries/services that you can use to set up authentication in Next.js. The list is not exhaustive, and if you find a library you like that is not listed here, that library might be good as well. Play with the options you have and choose the one you think is a good fit for your codebase.
Self-Hosted
- NextAuth (Auth.js)
- Better Auth
- Build your own solution using guides like Lucia Auth Documentation or Roll Your Own Auth.
Hosted
- Clerk
- Auth0
- Kinde
- Ory
- Stack Auth (also offers a self-hosted option)