Description
In this tutorial, we're gonna build a Node.js & MongoDB example that supports User Authentication... Tagged with node, javascript, security, webdev.
Summary
- Token Based Authentication Comparing with Session-based Authentication that need to store Session on Cookie, the big advantage of Token-based Authentication is that we store the JSON Web Token (JWT) on Client side: There are three important parts of a JWT: Flow for Signup & Login with JWT Authentication A legal JWT must be added to HTTP x-access-token Header if Client accesses protected resources.
- Controllers interact with MongoDB Database via Mongoose library and send HTTP response (token, user information, data based on roles...) to Client.