diff --git a/keycloak/keycloak_openid.py b/keycloak/keycloak_openid.py index ebd469f..61703e7 100644 --- a/keycloak/keycloak_openid.py +++ b/keycloak/keycloak_openid.py @@ -162,7 +162,7 @@ class KeycloakOpenID: "redirect-uri": redirect_uri} 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 exchanging an authorization code or by supplying credentials directly depending on @@ -183,6 +183,8 @@ class KeycloakOpenID: payload = {"username": username, "password": password, "client_id": self.client_id, "grant_type": grant_type, "code": code, "redirect_uri": redirect_uri} + if payload: + payload.update(extra) if totp: payload["totp"] = totp