Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprende Hashing Passwords and Managing Credentials | Implementing Authentication in Next.js
Next.js 14 Mastery for Building Modern Web Apps
course content

Contenido del Curso

Next.js 14 Mastery for Building Modern Web Apps

Next.js 14 Mastery for Building Modern Web Apps

1. Introduction to Next.js
2. Setting Up a Next.js Project
3. Building Pages and Layouts in Next.js
4. Deploying a Next.js App and Setting Up a Database
5. Fetching and Displaying Data in Next.js
6. Advanced Next.js Features and Optimizations
7. Implementing Authentication in Next.js

book
Hashing Passwords and Managing Credentials

Hashing passwords is a safety measure before storing them in a database. It transforms a password into a fixed-length string, appearing random for added security, even if user data is exposed.

In the seed.js file, we utilized a package called bcrypt to hash the user's password before storing it in the database. We will use bcrypt later to compare user-entered passwords with the stored ones.

Back to the Project

To use bcrypt in Next.js Middleware, a separate file named auth.ts is created. It includes the authConfig object.

Creadentials Provider

Providers in NextAuth.js are like different login options, such as Google or GitHub. They offer various ways for users to log in.

In the auth.ts file, we're adding a provider called Credentials. This allows users to log in using a username and password.

In Practice

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 7. Capítulo 5
We're sorry to hear that something went wrong. What happened?
some-alt