I am using an express app and I want to to implement token based authentication I wonder what libraries do I need mainly on both client side and server side? I looked at express-jwt I don't see that library can actually sign the web tokens but I can clearly see that it used for verification so do I need node-jsonwebtoken as well in my package.json? and on the client side I am thinking something like jwt-decode?
Asked
Active
Viewed 145 times
0
-
`express-jwt` is built upon `jsonwebtoken`, both being from open source code repo of (auth0)[auth0.com]. `express-jwt` gives a ready middleware to be passed to your handler or router, as you need. Whereas, with `jsonwebtoken` you have freedom to write a middleware yourself. – Prateek Gupta Oct 18 '16 at 14:10
1 Answers
0
If you're looking for a working example using json web token for authentication, you may want to check out this nice tutorial: http://jasonwatmore.com/post/2015/12/09/MEAN-Stack-User-Registration-and-Login-Example.aspx#views-folder
It explains how to build a JWT-based authentication in a simple way using MEAN stack (NodeJS, Express, Angular, MongoDB). The author uses jsonwebtoken npm package to sign token. This package can also be used to verify tokens.

Yuri Predborski
- 186
- 1
- 1
- 12