panva / openid-client

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

Can't authenticate when the server advertises authorization_response_iss_parameter_supported #647

Closed protoism closed 10 months ago

protoism commented 10 months ago

Describe the bug

Exception when trying to authenticate with a simple Keycloak server

To Reproduce

A bit complicate.. We're using boxyhq's saml-jackson library...

Steps to reproduce the behaviour:

Expected behaviour No exception

Environment: Node 20

Additional context

While there might be some problem in saml-jackson, I wonder if this code in lib/client.js is correct:

    } else if (
      this.issuer.authorization_response_iss_parameter_supported &&
      !('id_token' in params) &&
      !('response' in parameters)
    ) {
      throw new RPError({
        message: 'iss missing from the response',
        params,
      });

Is checking for 'id_token' the right thing to do?

panva commented 10 months ago

Yes it is the right thing to do. When authorization_response_iss_parameter_supported is advertised and there's no ID Token or JARM response the server is supposed to return an iss parameter.

protoism commented 10 months ago

I read the code better, and you're absolutely right. Thanks... the issue is simply on saml-jackson, then, which is filtering out 'iss'