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

Detailed video about next-auth:

Role-Based Authorization with next-auth:

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

GitHub Repo(don’t forget to give it a ⭐):

my discord server:

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