Hi,
I use the @auth0/auth0-spa-js library version 1.6.2 in my React app. I followed this tutorial Auth0 React SDK Quickstarts: Call an API and the authentication flow works fine.
However there’s a thing which bugs me a little bit. During data fetching I follow the pattern mentioned in the tutorial:
const token = await getTokenSilently();
const response = await fetch("/api/external", {
headers: {
Authorization: `Bearer ${token}`
}
});
I get the token as expected without a network request in normal cases, however it takes longer than I expected. I checked it with various tools and it usually takes about 50ms which seems a too long to me. I did this test on a 2018 MacBookPro, I guess it might take longer on weaker devices.
Do you know any workaround?
Regards,
Laszlo