-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use requestAgentOptions with ExpressJwtOptions / Typescript #167
Comments
I'm running into the same problem. We need this option so we can set our custom CA. |
FYI: This is my workaround for the problem. // TODO: Temporary fix until "node-jwks-rsa" project adds native support for the requestAgentOptions property.
// Extend ExpressJwtOptions interface.
// Must extend BEFORE we use jwksRsa.expressJwtSecret.
declare module "jwks-rsa" {
interface ExpressJwtOptions {
requestAgentOptions?: AgentOptions;
}
}
jwt({
// Dynamically provide signing keys
// provided by the JWKS endpoint.
secret: jwksRsa.expressJwtSecret({
strictSsl: true,
requestAgentOptions: {
ca: fs.readFileSync(path.resolve(__dirname, "ca.crt"), "utf8")
},
cache: config.get("jwt.cache") as boolean,
rateLimit: config.get("jwt.rateLimit") as boolean,
jwksRequestsPerMinute: config.get("jwt.jwkRequestsPerMin") as number,
jwksUri: config.get("jwt.jwkUri") as string
}),
audience: config.get("jwt.audience") as string,
issuer: config.get("jwt.issuer") as string,
algorithms: config.get("jwt.algorithms") as string[],
}) I hope this helps! |
Hey all, currently we are gating a lot of the agent options for the request, but what we are looking at doing is exposing the ability to completely override the agent used. |
I have encountered this problem as well. Currently building a Nestjs app. Using your workaround, I can confirm that it works. Thank you. |
We're using version 1.9.0 with express and express-jwt
The text was updated successfully, but these errors were encountered: