Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keycloack - get accessToken via Password grantType - requires client_secret

Tags:

keycloak

As a newbie of Keycloak, I try to configure a client with a "Password" grant type. I know that this is not the preferred solution in most cases.

I created a realm 'realm2' with a client 'myclient2' and a user.

When trying to get the token with Postman, I get this error:

{
    "error": "unauthorized_client",
    "error_description": "Client secret not provided in request"
}

When I add the client_secret, I get the token. I tried to provide a username and password and no secret.

Via the Keycloak user interface I can also login as 'johan' in the 'realm2'.

This is my request in Postman:

enter image description here

In Keycloak I configured the 'realm2' with no special properties set:

enter image description here

The client 'myclient2' is:

enter image description here

I can see on the Credentials tab of the client:

enter image description here

I configured 1 user in the realm2 with just 'password' as a password:

enter image description here

How can I configure my Keycloack settings so I don't need the 'secret' but the username and password?

like image 505
tm1701 Avatar asked Oct 21 '25 04:10

tm1701


1 Answers

You could disable authentication for the client, making it public. You can do this by turning off "Client authentication" under the settings tab of your client.

EDIT: I just realized your keycloak version seems different to mine. This configuration is likely under the Access Type selector in your settings tab, by changing it from confidential to public

like image 79
Haf Avatar answered Oct 26 '25 19:10

Haf



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!