Reputation: 804
I'm building an API using Nodejs/express and exploring different ways to implement authentication/authorization.
I've come across two packages which seem to do similiar things:
Passport with jwt strategy and jsonwebtoken
I really don't understand the difference between the two, but passport seems a lot more complicated. I know these kind of questions generally don't fair well on stack-overflow but i genuinely don't understand the difference between the two but it seems passport is generally better received? Can somone explain whether or not these packages truly accomplish the same goal or if there's a reason to use one over the other?
Thanks.
Upvotes: 2
Views: 799
Reputation: 1007
Passport is "Passport is authentication middleware for Node.js. Extremely flexible and modular" as they say it has lot's of strategies among that passport-jwt is one.
What Passport did is they brought all the different strategies together like google-auth Facebook-authentication local-authentication and so on .
jsonwebtoken is a strategy same as passport-jwt but it is individual & passport is group of strategies .
In my opinion you should learn passport as learning it you can use all kinds of strategies.A strategy is type of authentication .
Pardon me for my english hope you get it
Upvotes: 2