Overview
Save Big on Coursera Plus. 7,000+ courses at $160 off. Limited Time Only!
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