Auth0 Home Blog Docs

(ECONNREFUSED 52.42.231.47:443) Not able to authenticate API from Auth0 (Node js + Express + React js)

auth0
api
nodejs
express
reactjs
#1

Hello All,
Apologies for not submitting my question properly the last time, i have described my problem with the actual code and screenshots this time.
I have defined the identifier for my auth0 api as: http://localhost:3001

I have created my api in node.js as:

app.get("/private", checkJwt, function(req, res) {
res.json({
message: “Hello from a private API!”
});


I have implemented checkJwt as:

const checkJwt = jwt({

secret: jwksRsa.expressJwtSecret({
cache: true,
rateLimit: true,
jwksRequestsPerMinute: 5,
jwksUri: https://${ process.env.REACT_APP_AUTH0_DOMAIN }/.well-known/jwks.json
}),

audience: process.env.REACT_APP_AUTH0_AUDIENCE,
issuer: https://${process.env.REACT_APP_AUTH0_DOMAIN}/,

algorithms: ["RS256"]

});

Where REACT_APP_AUTH0_DOMAIN is my tenant id and REACT_APP_AUTH0_AUDIENCE is http://localhost:3001


After this, i am hitting my api as:

fetch("/private", {
headers: { Authorization: Bearer ${this.props.auth.getAccessToken()} }
})
.then(response => {
if (response.ok) return response.json();
throw new Error(“Network response was not ok.”);
})

Where, i am passing the access token to it correctly, (i verified it from my local storage).


After all these steps, whenever i hit my api i get the following error:–

Please anyone can direct to me where i am doing wrong?

Error while trying to access api from my React-App
#2

An addition to the details, that i am behind a corporate proxy network, is that the problem?

#3

Typically in this situation you will need to whitelist IPs - the page below from Docs will get you started down that path: