Skip to content
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

EDC 0.5.1 - OAuth2 Identity Service extension: scope empty and keycloak gives back error #3923

Closed
idoiamurua opened this issue Feb 27, 2024 · 1 comment · Fixed by #3933
Closed
Assignees
Labels
bug Something isn't working

Comments

@idoiamurua
Copy link

idoiamurua commented Feb 27, 2024

Bug Report

Describe the Bug

We have been using 0.3.1 version of the EDC connector together with the OAuth2 Identity Service extension. We used keycloak as the Identity Server.
Now, we have upgraded the EDC connector to version 0.5.1, and we are having problems when the connector tries to get a token from keycloak. The connector invokes the Keycloak service specified at edc.oauth.token.url configuration parameter (e.g.: /realms/bcssd/protocol/openid-connect/token) posting the following data:

grant_type=client_credentials&scope=&client_assertion=

where scope is empty,.
Keycloak server answers with the following error message:

{"error":"invalid_scope","error_description":"Invalid.scopes:."}

Expected Behavior

May be if no scope parameter is sent to keycloak when invoking edc.oauth.token.url service, keycloak would return the token correctly.

Observed Behavior

Keycloak returns the following error:
{"error":"invalid_scope","error_description":"Invalid.scopes:."}

Steps to Reproduce

  1. Configure 2 EDC connectors with OAuth2 Identity Service extension.
  2. Start the 2 EDC connectors.
  3. Invoke any management service that requires to send a message from one connector to the other, e.g.: /management/v2/catalog/request
curl --location 'http://bcssd2.tri.lan:9193/management/v2/catalog/request' \
--header 'X-API-Key;' \
--header 'Content-Type: application/json' \
--data-raw '{
      "@context": {
        "edc": "https://w3id.org/edc/v0.0.1/ns/"
      },
      "providerUrl": "http://bcssd1.tri.lan:9194/protocol",
      "counterPartyAddress": "http://bcssd1.tri.lan:9194/protocol",
      "protocol": "dataspace-protocol-http"
    }'
  1. Check error returned:
[
    {
        "message": "Unable to obtain credentials: Server response to [POST, http://ekodata2.tri.lan:8080/realms/bcssd/protocol/openid-connect/token] was not one of [200] but was 400: {\"error\":\"invalid_client\",\"error_description\":\"Client authentication with signed JWT failed: Token reuse detected\"}",
        "type": "BadGateway",
        "path": null,
        "invalidValue": null
    }
]

Context Information

  • Used version EDC v0.5.1
  • OS: Linux
  • Keycloak version: image: quay.io/keycloak/keycloak:22.0.3

Possible Implementation

Remove scope parameter when invoking edc.oauth.token.url ?

Copy link

Thanks for your contribution 🔥 We will take a look asap 🚀

@idoiamurua idoiamurua changed the title EDC 0..5.1 - OAuth2 Identity Service extension: : scope empty and keycloak gives back error EDC 0.5.1 - OAuth2 Identity Service extension: : scope empty and keycloak gives back error Feb 27, 2024
@idoiamurua idoiamurua changed the title EDC 0.5.1 - OAuth2 Identity Service extension: : scope empty and keycloak gives back error EDC 0.5.1 - OAuth2 Identity Service extension: scope empty and keycloak gives back error Feb 27, 2024
@ndr-brt ndr-brt added bug_report Suspected bugs, awaiting triage triage all new issues awaiting classification labels Feb 27, 2024
@ndr-brt ndr-brt added bug Something isn't working and removed bug_report Suspected bugs, awaiting triage triage all new issues awaiting classification labels Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants