Refresh Token with next-auth and Axios Interceptors in Next.js 13 Authentication

Опубликовано: 06 Октябрь 2024
на канале: Sakura Dev
57,986
1.1k

In this video, we will discuss how to refresh a token in Next.js 13 Authentication using next-auth and axios interceptors. This will allow us to use our authentication methods without having to send API keys every time.

Subscribe to my channel    / @sakuradev  

Detailed video about next-auth:    • Authentication with Next Auth and Nex...  

Role-Based Authorization with next-auth:    • Role Based Authorization with Next-Au...  

How to Manage Backend JWT Access Tokens in Next Auth and Next.js 13:    • How to Manage Backend JWT Access Toke...  

GitHub Repo(don't forget to give it a ⭐): https://github.com/vahid-nejad/Refres...

my discord server:   / discord  

0:00 Intro
0:15 Setting up next-auth with next.js 13
4:45 Introducing The Backend RefreshTokens API
6:44 App Directory Pages and Components
9:10 Reading AccessToken from Next-Auth Session and Send it with Axios Interceptors
15:27 useRefrshToken for Refreshing Access Token in Next-Auth Session
18:13 Integrating useRefreshToken with Axios Interceptors
22:16 Testing the Results