[keycloak-user] Can't invoke Keycloaks OpenID Connect token endpoint with grant type set to password

Виталий Ищенко betalb at gmail.com
Thu Dec 21 16:07:05 EST 2017


You need to pass client secret, note this part in provided json:
"clientAuthenticatorType"
: "client-secret"

You can find client secret on UI or use kcadm.sh

./keycloak/bin/kcadm.sh get clients/f3c2109d-9eb0-4fb3-b6be-32a52a691d42/
*client-secret* -r demo-realm

On Thu, Dec 21, 2017 at 6:22 PM Nicolas DUMINIL <
nicolas.duminil at simplex-software.fr> wrote:

> Hello,
>
>
>
> I'm following this blog (
> <
> http://blog.keycloak.org/2015/10/getting-started-with-keycloak-securing.htm
> l>
>
> http://blog.keycloak.org/2015/10/getting-started-with-keycloak-securing.html
> ) to secure some jax-rs services. I have the following client:
>
>
>
> ./keycloak/bin/kcadm.sh get clients/f3c2109d-9eb0-4fb3-b6be-32a52a691d42 -r
> demo-realm
>
> {
>   "id" : "f3c2109d-9eb0-4fb3-b6be-32a52a691d42",
>   "clientId" : "curl",
>   "surrogateAuthRequired" : false,
>   "enabled" : true,
>   "clientAuthenticatorType" : "client-secret",
>   "redirectUris" : [ " <http://localhost> http://localhost" ],
>   "webOrigins" : [ ],
>   "notBefore" : 0,
>   "bearerOnly" : false,
>   "consentRequired" : false,
>   "standardFlowEnabled" : true,
>   "implicitFlowEnabled" : false,
>   "directAccessGrantsEnabled" : true,
>   "serviceAccountsEnabled" : true,
>   "authorizationServicesEnabled" : false,
>   "publicClient" : true,
>   "frontchannelLogout" : false,
>   "protocol" : "openid-connect",
>   "attributes" : {
>     "saml.assertion.signature" : "false",
>     "saml.force.post.binding" : "false",
>     "saml.multivalued.roles" : "false",
>     "saml.encrypt" : "false",
>     "saml_force_name_id_format" : "false",
>     "saml.client.signature" : "false",
>     "saml.authnstatement" : "false",
>     "saml.server.signature" : "false",
>     "saml.server.signature.keyinfo.ext" : "false",
>     "saml.onetimeuse.condition" : "false"
>   },
>   "fullScopeAllowed" : true,
>   "nodeReRegistrationTimeout" : -1,
>   "protocolMappers" : [ {
>     "id" : "5916961f-e222-4a6d-968e-ca2031961168",
>     "name" : "family name",
>     "protocol" : "openid-connect",
>     "protocolMapper" : "oidc-usermodel-property-mapper",
>     "consentRequired" : true,
>     "consentText" : "${familyName}",
>     "config" : {
>       "userinfo.token.claim" : "true",
>       "user.attribute" : "lastName",
>       "id.token.claim" : "true",
>       "access.token.claim" : "true",
>       "claim.name" : "family_name",
>       "jsonType.label" : "String"
>     }
>   }
>
>
>
> I'm doing the following curl request:
>
>
>
> curl --data
>
> "grant_type=password&client_id=curl&username=customer-manager-user&password=
> toto"
> <http://localhost:18080/auth/realms/master/protocol/openid-connect/token>
> http://localhost:18080/auth/realms/master/protocol/openid-connect/token
>
>
>
> and I get the following error:
>
>
>
> {"error":"unauthorized_client","error_description":"UNKNOWN_CLIENT: Client
> was not identified by any client authenticator"}
>
>
>
> The user "customer-manager-user" is as follows:
>
>
>
> [jboss at ca385990f977 ~]$ ./keycloak/bin/kcadm.sh get users -r demo-realm -q
> username=customer-manager-user
> [ {
>   "id" : "52f6b73c-0982-415d-9157-a4735bf619b1",
>   "createdTimestamp" : 1513861722307,
>   "username" : "customer-manager-user",
>   "enabled" : true,
>   "totp" : false,
>   "emailVerified" : false,
>   "disableableCredentialTypes" : [ "password" ],
>   "requiredActions" : [ ],
>   "notBefore" : 0,
>   "access" : {
>     "manageGroupMembership" : true,
>     "view" : true,
>     "mapRoles" : true,
>     "impersonate" : true,
>     "manage" : true
>   }
> } ]
>
>
>
> I have googled in order to find a solution and I found several persons
> reporting the issue but I didn't find any solution. Many thanks in advance
> for any help.
>
>
>
> Kind regards,
>
>
>
> Nicolas
>
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user
>


More information about the keycloak-user mailing list