我目前正在使用 apollo 和 express。现在我想将 auth0 添加到解析器,但找不到有关它的文档(altought,graphcool 正在使用它)。通常,您在节点中执行以下操作:
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://YOUR_AUTH0_DOMAIN/.well-known/jwks.json`
}),
// Validate the audience and the issuer.
audience: '{YOUR_API_IDENTIFIER}',
issuer: `https://YOUR_AUTH0_DOMAIN/`,
algorithms: ['RS256']
});
然后你添加:
app.use(checkJwt)
并且您的 api 的根是安全的,等待access_token
.
我怎样才能设置阿波罗服务器 - 用这个表达?