Browse Source
Merge pull request #12 from kfox1111/token-extra
Add the option to specify extra key/values to the token endpoint
hotfix/merge
Marcos Pereira
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
3 additions and
1 deletions
-
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 |
|
|
|