keycloakkeycloak-rest-api

client-credentials is unsupported_grant_type


I am creating FastApi + KeyCloak application. Created realm, client and user

Client configuration enter image description here

My user configuration enter image description here

I can obtain token with help of this request

enter image description here

But for grant_type client-credentials I have an error:

{
    "error": "unsupported_grant_type",
    "error_description": "Unsupported grant_type"
}

What is the difference between "password" and "client-credentials"? And how to support client-credentials?


Solution

  • You need to use correct "client_credentials" (not "client-credentials") Grant Type.

    Required setting

    enter image description here

    Result

    enter image description here

    Difference client_credentials and password

    Difference between grant_type=client_credentials and grant_type=password in Authentication Flow?