Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nodejs Do I need to use Passport

Alright, so I'm currently coding a Web Application with Node.js, and I'm a bit stuck on how I should handle user logins/authentication.

Lots of tutorials seem to recommend using Passport for your authentication, but from all the documentation I've read, it seems to take a bit of setting up and it complicates the simple login I was expecting.

Whether or not I use Passport, I still plan on hashing my user passwords that are stored in the Mongo database.

So the question is, do I need to use Passport for security reasons, or can I just code an authentication system my self?

like image 503
Jonty Morris Avatar asked Mar 05 '16 03:03

Jonty Morris


People also ask

Why do I need Passport for Node JS?

Passport is authentication middleware for Node.js. Extremely flexible and modular, Passport can be unobtrusively dropped in to any Express-based web application. A comprehensive set of strategies support authentication using a username and password, Facebook, Twitter, and more.

Do we need Passport js?

Passport is a popular, modular authentication middleware for Node. js applications. With it, authentication can be easily integrated into any Node- and Express-based app. The Passport library provides more than 500 authentication mechanisms, including OAuth, JWT, and simple username and password based authentication.

What is the purpose of Passport js?

Passport is Express-compatible authentication middleware for Node. js. Passport's sole purpose is to authenticate requests, which it does through an extensible set of plugins known as strategies.

Which is better JWT or Passport?

JSON Web Token and Passport can be primarily classified as "User Management and Authentication" tools. JSON Web Token and Passport are both open source tools. It seems that Passport with 15.9K GitHub stars and 936 forks on GitHub has more adoption than JSON Web Token with 2.59K GitHub stars and 259 GitHub forks.


2 Answers

It's really up to you, if you don't need Facebook, Google, or Twitter logins or are fine coding your own, I would just build it from scratch.

I built an application for a company that didn't need all the bells and whistles that Passport came with, but needed it's own security built in, and found it much easier to just make my own. It's so easy to include your security as middleware in node!

like image 63
Morgan G Avatar answered Sep 30 '22 04:09

Morgan G


I think it depends your use.Generally set a password is necessary, and use passport is not complicated in Nodejs .Of course ,if your application is used in internal,password can be ignored.But I think security is provided.

like image 40
TanLingxiao Avatar answered Sep 30 '22 04:09

TanLingxiao