python-keycloak icon indicating copy to clipboard operation
python-keycloak copied to clipboard

Does KeycloakOpenID.token() API support get the access token for a client only with clientId and client secret?

Open buddha1987 opened this issue 4 years ago • 1 comments
trafficstars

I have created a client in keycloak and configure Service Accounts Enabled to enabled. I try to use API KeycloakOpenID.token() to get the access token for this client. When create the instance of KeycloakOpenID, I provided the clientId and client secret. and I call token() API as:

keycloak_openid.token(grant_type=["client_credentials"])

However, I got the exception and fail to get the token. When I use the post request it succeed. I just wonder whether this token() support getting token with grant_type=["client_credentials"] ?

Thanks.

buddha1987 avatar Mar 10 '21 16:03 buddha1987

I guess you need to set the client to confidential. Which endpoint did you use for the post request?

double-a avatar Apr 05 '21 11:04 double-a