Access JWT tokens in Axios interceptors in Next.js App router frontend
Unanswered
Northeast Congo Lion posted this in #help-forum
Northeast Congo LionOP
According to the requirements I was given, I need to store access token either in memory or local storage and the refresh token in a cookie. I can either use Zustand or React context for global state management and need to renew my tokens via the refresh token API. I am using cookies-next atm to store refresh tokens and keeping my access token in Zustand. I tried attaching my access token in the request interceptor but it keeps showing undefined and am unable to access my refresh token in the error callback of the response interceptor. Is there any solution or alternative approaches for this issue? Note that, I cannot change backend API.