When we call getAccessTokenSilently({ cacheMode: 'off '}) in our app, it re-renders everything - resulting in network requests being cancelled if called whilst in the middle of performing a request. Is this expected behaviour or something that has been seen before?
This had me get deep into the auth0-react codebase - when you call this function it dispatches an event in the auth0 context - which I am guessing forces an entire app refresh (or anything using the auth0 context). This generally makes sense as you likely want the user refreshed as well, but there are some cases where you might not.
dispatch({
type: 'GET_ACCESS_TOKEN_COMPLETE',
user: await client.getUser(),
});
You can get around this by generating your own Auth0Client instance and getting a new token directly via something like this:
const newToken = await client.getTokenSilently({
...options,
cacheMode: "off"
});
Hi @getbounds,
Welcome to the Auth0 Community and thanks for sharing this with the rest of us!
Have a great one!
Remus