我知道如何在快递服务器中验证auth0 jwt。我在标头中将jwt发送为Authorization: Bearer access_token
。但是,我无法在Strapi
这是我如何在快递服务器中验证auth0 jwt的代码
const express = require("express");
const app = express();
const jwt = require("express-jwt");
const jwksRsa = require("jwks-rsa");
const userReflection = require("./api/v1/user/reflection.js");
const checkJwt = jwt({
secret: jwksRsa.koaJwtSecret({
cache: true,
rateLimit: true,
jwksRequestsPerMinute: 5,
jwksUri: "https://random-texts.auth0.com/.well-known/jwks.json"
}),
audience: "http://localhost:1337",
issuer: "https://random-texts.auth0.com/",
algorithms: ["RS256"]
});
app.use("/api/v1/user", checkJwt, userReflection);
如何在Strapi中的每个请求中验证auth0 jwt?
答案 0 :(得分:0)