In this video, I will be showing how you can create JWT based authentication in NodeJS and create login, registration and logout functionality in NodeJS API. JSON web tokens are popular way to secure web applications. We will create access tokens and refresh token, and MongoDB will be used to save user data, and Redis will be used for storing Refresh Token and blacklisted access tokens.
Redis VS Code extension: https://marketplace.visualstudio.com/...
Git Repo: https://github.com/Sid-Shanker/jwt-au...
Concepts Covered:
Node.js JWT authentication
Node.js authentication middleware
Login & Registration APIs
Using refresh tokens with JWT
On Logout invalidating the tokens
Redis to store refresh tokens
Node.js MongoDB application architecture
Creating Node.js authentication middleware
Authenticating users with JWT
Invalidating refresh tokens to log users out
How to use JWT securely
Titles:
Securing Your Node.js App with User Authentication
Authentication 101: Implementing Login in Node.js
Adding User Login to Your Node.js Application
Authentication in NodeJS
Chapters:
0:00 Intro
0:37 What we will cover in this tutorial
1:00 P1: Project Setup
5:11 P1: Create Express Web Server
6:41 P1: Create Login route and logic
16:03 P1: Generating JWT access token
34:46 P1: Refresh Token Generation Strategy
37:55 P1: Implement Refresh Token
1:06:23 P2: Refactoring, MongoDB and Redis store
1:34:36 P2: Creating Redis Store
2:11:43 P2: Testing and debugging
Tags:
#NodeJS #JWT #Redis