Browse Source

fix: default scope to openid

pull/396/head
Richard Nemeth 2 years ago
parent
commit
451a22a103
  1. 8
      src/keycloak/keycloak_openid.py

8
src/keycloak/keycloak_openid.py

@ -260,6 +260,7 @@ class KeycloakOpenID:
code="", code="",
redirect_uri="", redirect_uri="",
totp=None, totp=None,
scope="openid",
**extra **extra
): ):
"""Retrieve user token. """Retrieve user token.
@ -283,6 +284,8 @@ class KeycloakOpenID:
:type redirect_uri: str :type redirect_uri: str
:param totp: Time-based one-time password :param totp: Time-based one-time password
:type totp: int :type totp: int
:param scope: Scope, defaults to openid
:type scope: str
:param extra: Additional extra arguments :param extra: Additional extra arguments
:type extra: dict :type extra: dict
:returns: Keycloak token :returns: Keycloak token
@ -296,6 +299,7 @@ class KeycloakOpenID:
"grant_type": grant_type, "grant_type": grant_type,
"code": code, "code": code,
"redirect_uri": redirect_uri, "redirect_uri": redirect_uri,
"scope": scope,
} }
if extra: if extra:
payload.update(extra) payload.update(extra)
@ -341,7 +345,7 @@ class KeycloakOpenID:
audience: str, audience: str,
subject: str, subject: str,
requested_token_type: str = "urn:ietf:params:oauth:token-type:refresh_token", requested_token_type: str = "urn:ietf:params:oauth:token-type:refresh_token",
scope: str = "",
scope: str = "openid",
) -> dict: ) -> dict:
"""Exchange user token. """Exchange user token.
@ -358,7 +362,7 @@ class KeycloakOpenID:
:type subject: str :type subject: str
:param requested_token_type: Token type specification :param requested_token_type: Token type specification
:type requested_token_type: str :type requested_token_type: str
:param scope: Scope
:param scope: Scope, defaults to openid
:type scope: str :type scope: str
:returns: Exchanged token :returns: Exchanged token
:rtype: dict :rtype: dict

Loading…
Cancel
Save