Member-only story

Auth0 React — 401 token error

Nazreen Mohamad
1 min readJun 22, 2023

--

So you’re trying to use Auth0 in your React (or any other SPA) application, and you follow their tutorial to the tee, but yet, it’s not working.

isLoading is false

user is undefined

isAuthenticated is false

What on Earth is going on?

I too was in your position, for a whole hour.

If you noticed it, the Network tab would list a failed request, with an error code of 401, with the response of:

{"error":"access_denied","error_description":"Unauthorized"}

The cause? An error in the configurations despite you having correctly selected ‘Single Page Application’.

The fix? Go to your Application’s settings, head to the Credentials tab and set the Method to ‘None’

How it should look like

In my case, and probably in yours, the Method was set to ‘Client Secret (Post). Which would be applicable if you were trying to communicate with the client via your backend.

That’s the fix, happy building!

--

--

Nazreen Mohamad
Nazreen Mohamad

Written by Nazreen Mohamad

Technical Instructor and Software Engineer.

No responses yet