From the course: Node: Authentication

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Implementing local authentication with Passport.js

Implementing local authentication with Passport.js

From the course: Node: Authentication

Implementing local authentication with Passport.js

- [Instructor] We are now going to implement so-called Passport Strategy, that tries to authenticate the user against the database. To kick this off, you first have to of course installed Passport and also the Local Strategy Module. For that, I'm stopping the Node.js process by pressing Control C in the console and there now type npm install -S passport passport-local. So that's the LocalStrategy. The LocalStrategy is always used when you have to implement your own logic on how credentials should be verified. In our case, now this means that we will validate against MongoDB. I already prepared the empty module where we will implement all the authentication logic. So I'm going to open Server, Lib, and in there, there is Passport in the Index.js file. So you see, this is an empty module, we just load the user service there already because we will use it to talk to the MongoDB. I will also start the Node.js process again…

Contents