NextJS Auth0 getAccessToken with refresh token only work for the first time

I have NextJs app and and NestJs Web API.
The NextJs will get an access token and forward it to the API, here is the code:

const { accessToken } = await getAccessToken(req, res, { refresh: true });

Here are my settings:

  • Refresh Token Rotation: Enable
  • Reuse Interval: 60 seconds.

My refresh token seems not to be updated and after 60 seconds passed, the error message appeared: AccessTokenError: The request to refresh the access token failed. CAUSE: invalid_grant (Unknown or invalid refresh token.)

  1. Seem the token was updated but the new refresh token was not updated. Is my code above correct or am I missing something?
  2. Concern: why does the token always get refreshed every time the getAccessToken method gets called even it has not yet expired?

Thanks,

I followed this.
AccessTokenRequest | @auth0/nextjs-auth0

Hi, were you ever able to get an answer or figure out a solution to this? Running into the same issue and according to the auth0 docs, whenever a refresh token is used to fetch a new access token, a new refresh token is sent back. So I would assume the session would be updated with that new refresh token, and the next time getAccessToken uses the refresh token, it uses the new one. But it doesn’t seem like that’s what is happening?