What does passport.js do and why we need it?

后端 未结 2 1359
-上瘾入骨i
-上瘾入骨i 2021-02-03 23:35

I am not familiar with user authentication in Node.js, now I am trying to create a website with a login system. I have managed to make it work using the code snippets from the w

2条回答
  •  清歌不尽
    2021-02-04 00:05

    Passport is a middleware for express.js. It supports various login types, Basic, Token, Local (username, password), OAuth, OAuth2, etc. We can combine these to allow users to authenticate by signing in with Google, FB, or whatever service with very minimal amount of code. We can also use this to combine external auth services so users can choose to login with one of the selected Strategies, e.g. Google, Twitter. It's much quicker to use passport for authentication than to build one yourself from scratch. This is why we use passport. You don't need passport, it just makes developing quicker. Read more from there website => http://www.passportjs.org/

提交回复
热议问题