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.)
- Seem the token was updated but the new refresh token was not updated. Is my code above correct or am I missing something?
- 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