User Authentication in Node.Js Using Passport.js (passport-local)

37
2



This video shows you how to implement user authentication (login and signup) with username and password using passport.js.

Passport.js is authentication middleware for node.js, it is extremely modular and flexible and widely used in express based web applications. A comprehensive set of strategies support authentication using a username and password, Facebook, Twitter, and more.

* Note – Avoid storing password hash in the session and using sync function in production.

[+] Sample Project Link :

Thank you watching this and subscribe for more videos like this

Nguồn: https://taiduc.org

Xem thêm bài viết khác: https://taiduc.org/the-thao/

37 COMMENTS

  1. I had a problem using it for two logins, I tried implementing a separate login for Admin and Clients with the same strategy but having issues on the admin's end……any hint or video on that?

  2. Sir who calls passport.use(new localStrategy(callback)) and when it is called as in case of simple routing like app.get("/goto",callback) will it get called.

  3. u could have used schema.pre('save',…..) middleware for hashing password. and es6 object shorthand syntax

  4. AAA… after all my efforts, at last! I have found this video! at last! a complete project that really works in 2019! thank you so much!!

  5. To avoid storing hash in the session, do this:

    if(valid) {
    doc.password = 'redacted'; //or something like null, up to you
    done(null,doc);
    }

    You also need to do this in your /register post function:

    user.password = 'redacted';
    before you res.send(user);

  6. nodejs express generating referral code or link for all user please get back to me as fast as possible……..thankz mustyytee@gmail.com

  7. Please use this github link for the source code :
    https://github.com/kharbanda14/youtube-tutorials/tree/master/node.js/authentication/passport-local-example

LEAVE A REPLY

Please enter your comment!
Please enter your name here