Auth0-react SDK index.js:1 Error: Login required

Please include the following information in your post:

  • Which SDK this is regarding: auth0-react
  • SDK Version: 1.2.0
  • Platform Version: Mac OS X/Chrome Version 86.0.4240.111 (Official Build) (x86_64)
  • Code Snippets/Error Messages/Supporting Details/Screenshots:
    Is this a feature request or bug report? I don’t know if this is a bug yet

I am following the react example with Github connection. The login succeeds and the app makes getAccessTokenSilently call and I see following error on the console.

index.js:1 Error: Login required
at new OAuthError (errors.tsx:8)
at utils.tsx:15
at auth0-provider.tsx:271
at step (1.chunk.js:210)
at Object.throw (1.chunk.js:141)
at rejected (1.chunk.js:103)

I am also seeing following under the “Issues” tab

I am happy to provide more data. What am I doing wrong?

Hi @support12,

The chrome warnings are likely just from the compatibility cookies, let’s ignore them for now.

The login required error occurs when the silent authentication request (which happens during getAccessTokenSilently) is not able to authenticate the user. There are two ways which the user can authenticate silently with this library. The first is through an auth0 session cookie, which can often be blocked by browsers or extensions. The other way that we can silently authenticate is with a refresh token, which you would have configured, as the cookie session is the default.

If you haven’t configured refresh token rotation, then I would guess the cookie is being blocked by a browser or extension. A few things to consider:

  • Incognito windows/tabs block third party cookies
  • Privacy extensions can often block cookies
  • Some browsers are beginning to block these cookie, safari particularly

If this is a cookie issue you can switch to refresh token rotation to solve the problem.

Otherwise we can explore more options if this is not the cause.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.