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

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 https://www.youtube.com/channel/UCTKSxERKbrpQOTa7QjDPjZg?sub_confirmation=1

Detailed video about next-auth: https://www.youtube.com/watch?v=cDWytA0V2kI

Role-Based Authorization with next-auth: https://www.youtube.com/watch?v=xJ6efexXJ7I

How to Manage Backend JWT Access Tokens in Next Auth and Next.js 13: https://www.youtube.com/watch?v=fYObrr3jf0w

GitHub Repo(don’t forget to give it a ⭐): https://github.com/vahid-nejad/Refresh-Token-Next-Auth

my discord server: https://discord.gg/BWN3yUqu

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