Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unable to get oauth token from Keycloak

I have an application which is getting Auth from Keycloak.

My Access Type is public so I do not have any client secret.

I have given access to "Direct Access Grants Enabled" as ON

Refer below:

enter image description here

I am getting error from postman as below:

{
    "error": "invalid_grant",
    "error_description": "Invalid user credentials"
}

Note : My credentials is right as I am using same to login on keycloak

I have also check the key and they seems correct as per below reference:

https://gist.github.com/rac021/623e4f4c87069acd0c38d952568f8a3d

while I have setup as per my understanding.

References:

enter image description here

enter image description here

Please let me know if I missing anything or you need any more details.

Any workaround will be appreciated !!!!

like image 327
Shubham Jain Avatar asked Jan 08 '18 08:01

Shubham Jain


2 Answers

The error message "Invalid user credentials" is reliable. That is, you either specified a wrong username or password.
Check that the user really exists in the realm you are addressing with the URL. Particularly if it is not the master realm which usually will be used to login to keycloak admin console.

like image 130
Boomer Avatar answered Oct 17 '22 17:10

Boomer


I had the same problem. Mine was due the the OTP (optional) in the direct grant Flow

like image 6
Yiping Avatar answered Oct 17 '22 19:10

Yiping