panva / openid-client

OAuth 2 / OpenID Connect Client API for JavaScript Runtimes
MIT License
1.83k stars 392 forks source link

No call to /oidc/certs with custom http_options #496

Closed tatiNo5 closed 2 years ago

tatiNo5 commented 2 years ago

Describe the bug I'm setting the http client options and expect to see a request to /oidc/certs endpoint where the public keys of the oidc provider are taken from, which should be used for the id_token validation.

To Reproduce Here is my code:

  const issuer = await Issuer.discover(ISSUER)

  const client = new issuer.Client({
    client_id: CLIENT_ID,
    client_secret: CLIENT_SECRET,
    redirect_uris: [REDIRECT_URL],
    response_types: ['code']
  })

  if (PROXY_HOST && PROXY_PORT && CA_CERT) {
    client[custom.http_options] = function (url, options) {
      console.log(url)
      const agent = tunnel.httpsOverHttp({
        ca: [fs.readFileSync(CA_CERT)],
        proxy: {
          host: PROXY_HOST,
          port: PROXY_PORT
        }
      })
      options.agent = agent
      return options
    }
  }

Expected behaviour To see in the console log entries for the /oidc/certs endpoint as there are for /oidc/userinfo and /oidc/token.

Environment:

Additional context The issue is tested and reproduced with 3.2.3 and latest 5.1.6 versions.

panva commented 2 years ago

https://github.com/panva/node-openid-client/blob/main/docs/README.md#customizing-individual-http-requests

Those are made by the Issuer instance.

tatiNo5 commented 2 years ago

Thank you, Filip. Make sense :)