@auth0/auth0-react - isAuthenticated is always false

Hello,

I am trying to implement @auth0/auth0-react into my React application, but cannot get my users authenticated for some reason. Clearing the cache and authenticating works as expected, I get sent to my tenants authentication page. Logging in is successful, redirects back to my application, but isAuthenthicated is still false. Trying to “log in” again using withAuth0’s loginWithRedirect just refreshes the page.

I followed the set up in the auth0-react-sample-classes tutorial, and have a nearly identical setup auth0-wise.

  • Which SDK this is regarding: e.g. @auth0/auth0-react

  • SDK Version: e.g. 1.6.0

  • Platform Version: React 16.13.1,

  • Code Snippets/Error Messages/Supporting Details/Screenshots:

<Auth0Provider
        domain={domain}
        clientId={clientId}
        redirectUri={window.location.origin}
        onRedirectCallback={onRedirectCallback}
        audience={audience}
      >
        {props.children}
      </Auth0Provider>

Any and all suggestions are greatly appreciated!

Bump. This is still a big issue.

Similar issues were reported and closed in other threads without any followup. [This thread](isAuthenticated is false after successful login with @auth0/auth0-react and ) mentiones custom domains as the issue, but this is not something I have activated or used (auth is still tenant.auth0.com).

Again, any and all tips are greatly appreciated - this is a critical issue for me.

What I would suggest here to handle that most effectively would be to create the issue in the repo so we can work on that directly with the repo maintainers. Once you have the link to it please share it here so we can ping them. Thank you!

Found out what the issue was - I had foolishly used both the useAuth0 hook and the withAuth0 HOC in the same component. Removing the HOC and turning the class into a const solved my issue.

1 Like

Perfect! Glad to hear that and thanks for sharing with the rest of community!