Hi @kobim
Welcome to the Auth0 Community!
I am sorry about the delayed response to your inquiry!
The respective error might be thrown by the application because the refresh token that it is trying to retrieve in order to refresh the session has expired or invalidated. I would recommend to increase the expiration or refresh threshold as mentioned in our documentation.
For the behaviour described above, I would simply suggest to increase the lifetime of the refresh token or force re-authentication.
Also, could you try the following code and let me know if that changes the behaviour in any way?
export default async function MyHandler(req, res) {
const accessToken = await getAccessToken(req, res, {
refresh: true,
afterRefresh,
});
};
I would also suggest to take a look at the documentation available on github regarding retrieving an access token for your application.
If none of the solutions proposed above seem to be working, please open an issue on the NextJS Github page.
If you have any other questions or updates on the matter, let me know!
Kind Regards,
Nik