bitcoinbad.blogg.se

Passportjs
Passportjs









“passport-local”, “passport-facebook”, “passport-oauth-google” etc. The secondary “strategy” library is dependent on the methodology you plan use to authenticate a user.

passportjs

you will import this library irrespective of the type of “Strategy” that you will use to authenticate the user).

  • The primary “Passport JS” library is always required, and is used to maintain session information for authenticated users (i.e.
  • passportjs

    The first is the main “Passport JS” library, and the second is the relevant “strategy” library. I understand that there must be some very important functionality that I neglect, but after browsing many web resources, including stackoverflow, youtube, passport.js's docs and many others, I still didn't understand what does passport.js do and why we need it.Īpologies in advance if the question seems silly.It is important to understand that the Passport JS framework, consists of 2 separate libraries. After user identity has been confirmed we can use the express-session to store the session in the cookie for login persistence.Ī video about the process that I described above can be found here. This, as well, can be done without passport. We can simply check the user's email or username against our database, and then check the password after email or username is matched.

    passportjs

    Let's take passport-local as an example, when we are using the passport middleware, we basically is trying to create a new document in the database, then can we do it without passport, such as using the MongoClient directly, with checkings of duplicates, and store the password after encryption. I have managed to make it work using the code snippets from the website, but I don't really understand why we need the passport.js as a middleware to do the authentication. I am not familiar with user authentication in Node.js, now I am trying to create a website with a login system.











    Passportjs