Unable to retrieve user information after login using auth0 SDK for React

I am following a quickstart guide with React. I have followed each and every step mentioned in the guide but i am stuck at a problem i haven’t found a solution to.

Problem is that i am able to login and logout but the user profile information is always undefined. I am using userAuth0() hook to retrieve user information after logging in.

I looked at the network tab in developer tools of chrome and it seems that request for token is failing with response status code of 401.

While i was searching for the solution, i came across a similar stackoverflow question which hasn’t been answered yet.
Need help in figuring out the solution to the problem.

SDK:
@auth0/auth0-react: 1.1.0

Hey @sindora, Welcome to the Auth0 Community!

Can you DM me a HAR file, detailing the issue?
Method to get HAR File : https://auth0.com/docs/troubleshoot/har

Regards,
Sidharth

Hi @sidharth.chaudhary, Its been 3 days since i sent you the HAR file. Is there any update regarding the issue?

@sindora, Had a look at your HAR file just now, the /token endpoint is returning 401 error with unauthorized/access denied error , its not explicitly mentioned in the Error logs about the cause of error , but my understand is your Token Endpoint Authentication Method in your Application setting( Default App) is incorrectly set for to POST,

Possible values for this setting(Token Endpoint Authentication Method) are ‘None’ (public application without a client secret), ‘Post’ (application uses HTTP POST parameters) or ‘Basic’ (application uses HTTP Basic).

Since your application is SPA, it should be ideally None.

Can you try creating a new client with SPA type and make sure Token Endpoint Authentication Method is set to none and try again?

1 Like

That was it.
Creating the new single-page application application solved the problem. Thank you for your help.

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