express-jwt icon indicating copy to clipboard operation
express-jwt copied to clipboard

Middleware not work behind a corporate proxy

Open xzegga opened this issue 7 years ago • 0 comments

I am using Auth0 token to authenticate to graphql calls, All works fine, but when I am in a corporate proxy auth0 middleware not work correctly an gives me the error:

POST /api/graphql 500 1212.816 ms - 263
Error: connect ECONNREFUSED 52.9.22.213:443
    at Object.exports._errnoException (util.js:1022:11)
    at exports._exceptionWithHostPort (util.js:1045:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1090:14)

This is my middleware configuration

const checkJwt = jwt({
  secret: jwks.expressJwtSecret({
    cache: true,
    rateLimit: true,
    jwksRequestsPerMinute: 5,
    jwksUri: "https://company-name.auth0com/.well-known/jwks.json"
  }),
  issuer: "https://company-name.auth0.com/",
  algorithms: ['RS256']
});

And then I use in routes like this:

router.use('/api/graphql', checkJwt, GraphHTTP({
      schema: Schema,
      pretty: true,
      graphiql: true
    }));

xzegga avatar May 16 '17 21:05 xzegga