Auth0 – 401/Unauthorized when obtaining token for SPA Single Page Application

This post will explain the steps to resolve the 401/Unauthorized error when obtaining token using Auth0 for SPA Application

Please refer to our previous tutorials on how to setup the Auth0 sign in using NodeJS

There is a bug when configuring Auth0 application settings for SPA Application as of writing this post. Please note to follow the below steps only when you get the 401/Unauthorized token error when all other setup is complete and it is still not working.

The token authentication method for SPA Application should be set to None but there is no option to update this under the Settings tab while configuring the application

The below steps will provide a quick turnaround solution to fix this issue

Navigate to the Settings and under Application Properties change the application type from Single Page application to Regular Web application

There will be a Note visible to change the token_endpoint_auth_method. Click on View Credentials which would take you to the Credentials tab which was not displayed until now

Change the Authentication Methods under the Credentials tab from Post to None and click on Save

Navigate back to Settings tab and change the application type back to Single Page Application and click on Save

Hope this post fixed the 401 Unauthorized token issue

Leave a Reply