Get config variables in auth0 in env file
This commit is contained in:
19
api/middleware/secure.js
Normal file
19
api/middleware/secure.js
Normal file
@@ -0,0 +1,19 @@
|
||||
const jwt = require("express-jwt");
|
||||
const jwksRsa = require("jwks-rsa");
|
||||
|
||||
const secure = jwt({
|
||||
// Dynamically provide a signing key based on the kid in the header and the signing keys provided by the JWKS endpoint
|
||||
secret: jwksRsa.expressJwtSecret({
|
||||
cache: true,
|
||||
rateLimit: true,
|
||||
jwksRequestsPerMinute: 5,
|
||||
jwksUri: `https://${process.env.SNOWPACK_PUBLIC_AUTH0_DOMAIN}/.well-known/jwks.json`,
|
||||
}),
|
||||
|
||||
// Validate the audience and the issuer
|
||||
audience: `https://${process.env.SNOWPACK_PUBLIC_API_DOMAIN}/`, //replace with your API's audience, available at Dashboard > APIs
|
||||
issuer: `https://${process.env.SNOWPACK_PUBLIC_AUTH0_DOMAIN}/`,
|
||||
algorithms: ["RS256"],
|
||||
});
|
||||
|
||||
module.exports = secure;
|
||||
Reference in New Issue
Block a user