Auth0 Home Blog Docs

Spring Security, 401 when following quick start guide


I have followed the quick start guide on spring security to implement Auth0 according to this page:

However, when I test it, all links under .antMatchers .authenticated and .hasAuthority is getting 401 error, even though I am requesting with a bearer header? Below is the curl request (I am using windows). I copied the token from the ‘test’ tab in the API.

    curl -H ${'authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6Ik1ERkJPRGxETkRNeFJqRTVSa

mwut8xg’} http://localhost:8080/api/positions/all

I have already made sure that the auth0.apiAudience and auth0.issuer matched the one in the API.
I have tried accessing the .permitAll end point and it worked just fine.
Is there an important step that I missed?


Hi there @Hugi, I wanted to reach out and see if I can snag a HAR file from you when you are receiving the 401 error along with your tenant name? This will allow us to take a deeper look at what’s going here when you are experiencing this issue. Thanks in advance!


I wanted to touch base and see how things are coming on obtaining that HAR file. Please let us know if you have any questions.

closed #5

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