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

updateIdentetyProvider - either "RESTEASY003065: Cannot consume content type" or ""error" => "HTTP 404 Not Found"" #108

Open
Eorana opened this issue May 10, 2023 · 0 comments

Comments

@Eorana
Copy link

Eorana commented May 10, 2023

Hello,

I'm trying to update a Keycloak identity provider, and I'm encountering some issues.
According to keycloak-1_0.php, I tried the following:

        $output = $this->keycloakAdminApi->updateIdentityProvider([
                "realm"         => "myrealm",
                "alias"         => "test",
                "enabled"   => false,
            ]);
        
        dd($output);

However, I'm getting the following error message:
string(43) "RESTEASY003065: Cannot consume content type"

To investigate further, I tried making the request from Postman using the JSON payload {"alias":"test", "enabled":false}, and I received the error message : "errorMessage": "Invalid identity provider id [null]"

I found that the request works fine in Postman by adding the providerId field to the JSON payload:
{"alias":"test","providerId":"oidc","enabled":false}

Based on this observation, I modified my code to include the providerId field:

        $output = $this->keycloakAdminApi->updateIdentityProvider([
                "realm"         => "myrealm",
                "alias"         => "test",
                "providerId"    => "oidc",
                "enabled"   => false,
            ]);
        
        dd($output);

However, I'm now receiving an error message: "error" => "HTTP 404 Not Found"

I noticed that the documentation doesn't mention the providerId field as a required one, but it seems to be necessary for the request to work correctly in Postman. I also attempted making the request with only the providerId field:
{"providerId":"oidc","enabled":false}

But it also resulted in the "error": "HTTP 404 Not Found" since no alias means no way to identify the identity provider.

I'm looking for suggestions or insights on how to fix my problem. Any ideas?

Edit: In order to get my code functioning, I switched to using Guzzle for updating the identity providers. The behavior observed is consistent with Postman: It only works when the providerId is included in the request body.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant