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

YouTube

React Persistent User Login Authentication with JWT Tokens

Dave Gray via YouTube

Overview

Learn how to implement persistent user login authentication with JWT tokens in a React application. Discover secure methods for handling authentication without storing tokens in local or session storage. Explore the creation of a PersistLogin component, updating the useRefreshToken hook, and addressing security issues. Implement a logout functionality, test various scenarios including expired tokens, and add a "Trust Device" feature. Master the techniques to maintain user authentication across app refreshes and revisits while ensuring security best practices.

Syllabus

Intro
Welcome Discussion
Current state of the app
Why want a persistent login?
PersistLogin component
useRefreshToken update
Add PersistLogin to App
Test the Persistent Login
Security Issue #1
useLogout hook
Add logout to Home
Test with no refresh cookie
Test with a refresh token
Test with an expired refresh token
Security Issue #2
Adding new state to AuthProvider
PersistLogin update
Login update
Test Trust Device toggle
Fix a memory leak

Taught by

Dave Gray

Reviews

Start your review of React Persistent User Login Authentication with JWT Tokens

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.