I am using latest auth0-react lib. After user logs in using universal login and database connection, getAccessTokenSilently, this trows error Login required. Everything works in chrome incognito mode. Same errors is Safari, Safari incognito mode. Seems to be related to cookies being blocked. It might be solved by using custom domain, are the solution for default auth0 domains? + Login Required seems to be confusing message in this case.
1 Like
Did you get any responses? I am facing similar problem.
I am having the same issue. getAccessTokenSilently works in chrome and firefox
It seems like the others on this thread are having configuration issues. For anyone who is like me and winding up here to figure out what is going on with this error, I wanted to share what I found:
- Both
login_required
andconsent_required
are legitimate opened responses. They seem to arise out of inactivity timeouts and needing more permissions respectively. (more info here: Final: OpenID Connect Core 1.0 incorporating errata set 1) - As such, when you use
getAccessTokenSilently
, you pretty much always need to wrap it in atry...catch
and look for these errors, a la:
try {
token = await getAccessTokenSilently();
} catch (e) {
if (e.error === 'login_required') {
loginWithRedirect();
}
if (e.error === 'consent_required') {
loginWithRedirect();
}
throw e;
}
The quick start doesn’t really make mention of this, but it is in an example in the auth0-react
repo, here: Code lifted from auth0-react/EXAMPLES.md at master · auth0/auth0-react · GitHub
Hopefully, this helps someone who is chasing their tail.
6 Likes
Thanks, this really helped me… And it’s not mentioned in the guides…
Greate answer my friend, works for me, after several hours finding solution