Auth0 Home Blog Docs

NodeJS - Failed to obtain access token

auth0
nodejs
access_token
error
access-token

#1

Hello. I set up a local NodeJS server with nothing but Auth0 and Pug modules, along with pages for testing authentication. I set up the login & callback pages just like in the Quickstart guide for NodeJS. When a user logs in, the Log at the admin console says the user logged in successfully, but the page shows the error stated on the title.

I looked at the post with a similar problem, but the answers suggested to whitelist certain IP addresses if you set a Rule, Hook or custom database, neither of which I have set. Also, like the mentioned post, the local server is behind a company firewall.

The post I’m referring to is here.


#2

A Node.js application will be performing an authorization code grant which means that after the end-user completes authentication with success the application will receive a code and the Node.js backend will have to perform a call to https://{YOUR_TENANT}.auth0.com/oauth/token in order to exchange it for tokens.

You mention the server is behind a company firewall so you need to make sure that the Node.js server can reach the endpoint mentioned above.


#3

I tried suggestion, sending a POST request to the link you provided (with {YOUR_TENANT} replaced, of course). I got an error saying “Unable to get local issuer certificate”.