【发布时间】:2017-11-10 07:37:12
【问题描述】:
我在我的 express API 中使用中间件来验证 auth0
const checkJwt = jwt({
// Dynamically provide a signing key based on the kid in the header and the singing keys provided by the JWKS endpoint.
secret: jwksRsa.expressJwtSecret({
cache: true,
rateLimit: true,
jwksRequestsPerMinute: 5,
jwksUri: `https://${process.env.AUTH0_DOMAIN}/.well-known/jwks.json`
}),
// Validate the audience and the issuer.
audience: process.env.AUTH0_AUDIENCE,
issuer: `https://${process.env.AUTH0_DOMAIN}/`,
algorithms: ['RS256']
});
...
server.use('/api', checkJwt, routes);
它可以在我的本地开发机器上运行,但是当我在生产环境中运行它时,我得到:
Error: getaddrinfo ENOTFOUND undefined undefined:443
at errnoException (dns.js:28:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)
我在生产环境中运行 ubuntu 12,在开发环境中运行 mac。
【问题讨论】:
-
不要写
https:// -
如果我删除它,验证将失败。
-
你有回购吗?
-
不公开。但是没有比问题中更相关的代码了。
-
执行
console.log(`https://${process.env.AUTH0_DOMAIN}/.well-known/jwks.json`)并检查它是否未定义
标签: node.js linux express auth0