Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Password Hashing & Credentials | Authentication
Next.js 14

Password Hashing & CredentialsPassword Hashing & 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.

auth.ts

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.

auth.ts

In Practice

Everything was clear?

Section 7. Chapter 5
course content

Course Content

Next.js 14

Password Hashing & CredentialsPassword Hashing & 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.

auth.ts

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.

auth.ts

In Practice

Everything was clear?

Section 7. Chapter 5
some-alt