Skip to content

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

@Eorana

Description

@Eorana

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions