Browse Source

Add the option to specify extra key/values to the token endpoint

hotfix/merge
Kevin Fox 6 years ago
parent
commit
e68bbf2284
  1. 4
      keycloak/keycloak_openid.py

4
keycloak/keycloak_openid.py

@ -162,7 +162,7 @@ class KeycloakOpenID:
"redirect-uri": redirect_uri} "redirect-uri": redirect_uri}
return URL_AUTH.format(**params_path) return URL_AUTH.format(**params_path)
def token(self, username="", password="", grant_type=["password"], code="", redirect_uri="", totp=None):
def token(self, username="", password="", grant_type=["password"], code="", redirect_uri="", totp=None, **extra):
""" """
The token endpoint is used to obtain tokens. Tokens can either be obtained by The token endpoint is used to obtain tokens. Tokens can either be obtained by
exchanging an authorization code or by supplying credentials directly depending on exchanging an authorization code or by supplying credentials directly depending on
@ -183,6 +183,8 @@ class KeycloakOpenID:
payload = {"username": username, "password": password, payload = {"username": username, "password": password,
"client_id": self.client_id, "grant_type": grant_type, "client_id": self.client_id, "grant_type": grant_type,
"code": code, "redirect_uri": redirect_uri} "code": code, "redirect_uri": redirect_uri}
if payload:
payload.update(extra)
if totp: if totp:
payload["totp"] = totp payload["totp"] = totp

Loading…
Cancel
Save