Browse Source

Merge pull request #324 from knackjax/client_credentials_fix

fix: allow client_credentials token if username and password not spec…
pull/289/head v0.29.1
Richard Nemeth 3 years ago
committed by GitHub
parent
commit
24c99726b0
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      src/keycloak/keycloak_admin.py

8
src/keycloak/keycloak_admin.py

@ -2566,13 +2566,15 @@ class KeycloakAdmin:
custom_headers=self.custom_headers, custom_headers=self.custom_headers,
) )
grant_type = ["password"]
grant_type = []
if self.client_secret_key: if self.client_secret_key:
grant_type = ["client_credentials"]
if self.user_realm_name: if self.user_realm_name:
self.realm_name = self.user_realm_name self.realm_name = self.user_realm_name
grant_type.append("client_credentials")
elif self.username and self.password:
grant_type.append("password")
if self.username and self.password:
if grant_type:
self.token = self.keycloak_openid.token( self.token = self.keycloak_openid.token(
self.username, self.password, grant_type=grant_type, totp=self.totp self.username, self.password, grant_type=grant_type, totp=self.totp
) )

Loading…
Cancel
Save