Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

JWT Authentication - Node JS and Express Tutorials for Beginners

Dave Gray via YouTube

Overview

Learn how to implement JWT Authentication in Node.js and Express to secure your REST API against XSS and CSRF attacks. This beginner-friendly tutorial covers setting up JWT tokens, creating verification middleware, applying token verification to routes, adding cookie-parser middleware, and implementing refresh and logout functionalities. The course also addresses frontend and backend requirements for proper authentication. The intended audience for this course is beginners looking to enhance the security of their Node.js and Express applications.

Syllabus

Intro
Welcome
JWT Authentication
Set up
Installing new dependencies
Creating environment variables
Creating JWT tokens at authorization
Creating JWT verification middleware
Applying JWT token verification to specific routes
Applying JWT token verification to many routes
Adding cookie-parser middleware
Creating a refresh token controller
Creating the refresh route
Adding the refresh route to the server
Testing the refresh route
Creating a logout controller
Creating the logout route
Adding the logout route to the server
A Quick Debug
Testing the logout route
Frontend: fetch needs the credentials option
Backend: CORS needs Access-Control-Allow-Credentials
Chrome requires specific cookie options

Taught by

Dave Gray

Reviews

Start your review of JWT Authentication - Node JS and Express Tutorials for Beginners

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.