unable to get oauth token from Keycloak

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.


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


I had the same error response in the postman, because I didn't added the role to client, which then must be added to user roles :

1) Create client role.

2) Add this role to user roles.

3) then token from postman was obtained without this error.