auth0-react: isAuthenticated returning false after successful login

Hi,

Its my first time using the auth0-react SDK. I’ve implemented the login flow using guide, and have configured my app on Auth0 with Social Connection to LinkedIn. First login, the user is redirected to the UniversalLogin when they can login through LinkedIn, but as the user is redirected back to the application, the isAuthenticated value still remains false, and I see the POST require to oauth/token returning 401 unauthorized. On the Auth0 dashboard it also showed a successful login attempt with the user account.

I’ve provided the Auth0Provider with the appropriate props & values filled in of course,

    <Auth0Provider
            domain=""
            clientId=""
            redirectUri={window.location.origin}
            audience=""
            onRedirectCallback={onRedirectCallback}>

Am I missing anything?

The request header for the failing oauth/token request includes grant-type: authorization-code, with the code values from successful login request. On the Auth0 documentation, it seems that client-side applications should only be using grant-type: implicit. Could this be the issue? Is there any way to specific the request sent by the SDK to oauth/token as grant-type=implicit? Any help in how to fix this issue is greatly appreciated 🙏🏼

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 23 (8 by maintainers)

Most upvoted comments

@adamjmcgrath Hi everyone, actually I have found a workaround on this issue even though I’m not exactly sure why this was the way it was. I also cannot replicate it, so maybe this will help (fingers crossed). My tenant was configured to be SinglePageApplication with Token End Point Authentication to be None

I actually changed it to be a few other variations of values including "Regular Web Application": POST & "Regular Web Application": None, saved my changes, and tried using the SDK to log in a couple more times.

Obviously the configurations above weren’t valid, so I switched back toSingle Page Application: None, and the SDK started returning the expected authentication values for me. You could try re-updating your tenant configuration, not sure if this will help anyone else experiencing this issue.

I have the same issue but @alicemao23’s fix didn’t work for me. Any updates on this?

Hi @alicemao23 - let me know if you’ve had any luck fixing your issue.

Another thing to check would be that you have “Allowed Web Origins” set correctly in your dashboard.

And that your Auth0 Application in your dashboard is set to “Single Page Application”

image

Let me know if either of those suggestions helps

Hi @alicemao23 - let me know if you’ve had any luck fixing your issue.

Another thing to check would be that you have “Allowed Web Origins” set correctly in your dashboard.

And that your Auth0 Application in your dashboard is set to “Single Page Application”

image

Let me know if either of those suggestions helps

after trying lots of alternatives this one has worked for me. from application type drop down menu you have to select single page application and the problem you are facing will probably disppear

@alicemao23 @adamjmcgrath That worked!

I first toggled our application to "Regular Web Application": None and that worked. I then toggled to "Regular Web Application": POST and Basic, neither of which worked. I then toggled it back to Single Page Application: None and it worked.

@adamjmcgrath I’ll have something out later this afternoon.