Overview
Google, IBM & Meta Certificates – 40% Off
One Coursera Plus subscription covers most Professional Certificates on Coursera.
Unlock All Certificates
This intermediate tutorial adds persistent user login to a React application with JWT access and refresh tokens, using a secure HTTP-only cookie rather than local or session storage. It implements refresh, logout, device trust, expired-token handling, and a memory-leak fix in an existing authentication app.
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