okta / okta-jwt-verifier-js

okta-jwt-verifier-js
https://github.com/okta/okta-jwt-verifier-js
Other
16 stars 9 forks source link

jwks-rsa client no longer supports `requestAgentOptions` #26

Closed dnafication closed 1 year ago

dnafication commented 1 year ago

Describe the bug?

Code location: https://github.com/okta/okta-jwt-verifier-js/blob/842952d60883d6f11f07df1e35e8b1ce3656dc82/lib.js#L183-L191

jwks-rsa does not support requestAgentOptions any more according to their changelog and instead allows for passing requestAgent itself.

Example:

// OLD
const oldClient = jwksClient({
  jwksUri: 'https://sandrino.auth0.com/.well-known/jwks.json',
  requestAgentOptions: {
    ca: fs.readFileSync(caFile)
  }
});

// NEW
const newClient = jwksClient({
  jwksUri: 'https://sandrino.auth0.com/.well-known/jwks.json',
  requestAgent: new https.Agent({
    ca: fs.readFileSync(caFile)
  })
});

Here's the reference: https://github.com/auth0/node-jwks-rsa/blob/b4be3390906b886529059316b987baf2aaddd521/CHANGELOG.md#migration-guide-from-v1-to-v2

What is expected to happen?

It should remove the deprecated option requestAgentOptions and add a new requestAgent option to allow users to configure http agent.

What is the actual behavior?

It still contains requestAgentOptions which is not supported by jwks-rsa.

Reproduction Steps?

Unable to set proxy

SDK Versions

@okta/jwt-verifier

Execution Environment

Node 16+

Additional Information?

I will send PR to allow users to pass requestAgent option.

dnafication commented 1 year ago

This should also be documented in the Release notes as a Breaking change for people passing options down requestAgentOptions or using implicit proxy env vars like HTTPS_PROXY.

denysoblohin-okta commented 1 year ago

Thanks for submitting this issue and PR with fix. Internal ref: OKTA-569666

FiretronP75 commented 1 year ago

My team needs this too. We need to use a proxy but we are currently blocked.

jaredperreault-okta commented 1 year ago

3.0.1 was just released, adding support for requestAgent