diff --git a/aiogoogle/__version__.py b/aiogoogle/__version__.py index 9ea6da9..5135ebf 100644 --- a/aiogoogle/__version__.py +++ b/aiogoogle/__version__.py @@ -2,7 +2,7 @@ __about__ = "Async Google API client" __description__ = __about__ __url__ = "https://github.com/omarryhan/aiogoogle" -__version_info__ = ("2", "1", "0") +__version_info__ = ("2", "1", "1") __version__ = ".".join(__version_info__) __author__ = "Omar Ryhan" __author_email__ = "omarryhan@gmail.com" diff --git a/aiogoogle/auth/managers.py b/aiogoogle/auth/managers.py index eb07110..eb9ff70 100644 --- a/aiogoogle/auth/managers.py +++ b/aiogoogle/auth/managers.py @@ -403,8 +403,7 @@ def authorization_url( (str): An Authorization URI """ client_creds = client_creds or self.client_creds - scopes = scopes or client_creds["scopes"] - scopes = " ".join(client_creds["scopes"]) + scopes = " ".join(scopes or client_creds["scopes"]) uri = ( self["authorization_endpoint"] + f'?redirect_uri={client_creds["redirect_uri"]}&scope={scopes}&' @@ -414,13 +413,12 @@ def authorization_url( "response_type": response_type, "state": state, "access_type": access_type, - "include_granted_scopes": json.dumps(include_granted_scopes), + "include_granted_scopes": include_granted_scopes, "login_hint": login_hint, "prompt": prompt, }.items(): if param is not None: - uri += "&" - uri += parse.urlencode({param_name: param}) + uri += f"&{parse.urlencode({param_name: json.dumps(param) if isinstance(param, bool) else param})}" return uri async def build_user_creds( @@ -980,13 +978,12 @@ def authorization_url( "response_type": response_type, "state": state, "access_type": access_type, - "include_granted_scopes": json.dumps(include_granted_scopes), + "include_granted_scopes": include_granted_scopes, "login_hint": login_hint, "prompt": prompt, }.items(): if param is not None: - uri += "&" - uri += parse.urlencode({param_name: param}) + uri += f"&{parse.urlencode({param_name: json.dumps(param) if isinstance(param, bool) else param})}" return uri async def build_user_creds(