Hey guys, I had the same issue and to understand I think you can see a good discussion at Failed Silent Auth - Login required
I’m also using auth0-spa-js on a react app, If you followed the quickstart for spas on auth0 there’s a file react-auth0-spa.js in that file in the Auth0Provider function there’s useEffect hook
in it, there’s a part where it checks if the user is authenthicated and sets the user.
if (isAuthenticated) {
const user = await auth0FromHook.getUser();
setUser(user);
}
What you can do is add an else statement in which you can call auth0FromHook.loginWithRedirect
else {
await auth0FromHook.loginWithRedirect({
appState: {targetUrl: window.location.pathname}
});
}
this will re-authenticate the user by refreshing the page, it caters for when there is cookie related issue.