I’m using auth0 react SDK (@auth0/auth0-react v1.2.0) and I need to refresh the access token when it expires.
Based on the docs I have to call
getAccessTokenSilently() before every API request so the SDK will either retrieve it from the local cache or Auth0 server (if token has expired).
Since the SDK provides only hooks to call
getAccessTokenSilently() I need to use it inside the components.
It would be great if I don’t have to repeat this in every component but to be able to put it inside the e.g. Axios interceptor and have it only at one place.
Is there any other option to solve this or I missed something from the docs?