From 58becac1a4030d9bc3daf089645c4412227c4679 Mon Sep 17 00:00:00 2001 From: Ryan Kohler Date: Thu, 3 Nov 2022 10:22:56 -0700 Subject: [PATCH] fix: include updates to properties from Google Auth lib (#249) * Include updates to properties from Google Auth lib * test for scopes * updating real deps --- google_auth_oauthlib/helpers.py | 2 ++ setup.py | 2 +- testing/constraints-3.6.txt | 2 +- testing/constraints-3.7.txt | 2 +- tests/unit/test_helpers.py | 8 ++++++++ 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/google_auth_oauthlib/helpers.py b/google_auth_oauthlib/helpers.py index 292c19d..97ddc87 100644 --- a/google_auth_oauthlib/helpers.py +++ b/google_auth_oauthlib/helpers.py @@ -133,6 +133,8 @@ def credentials_from_session(session, client_config=None): token_url=client_config.get("token_uri"), client_id=client_config.get("client_id"), client_secret=client_config.get("client_secret"), + token_info_url=client_config.get("token_info_url"), + scopes=session.scope, ) else: credentials = google.oauth2.credentials.Credentials( diff --git a/setup.py b/setup.py index 4a4640f..66f4bda 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ TOOL_DEPENDENCIES = "click>=6.0.0" -DEPENDENCIES = ("google-auth>=2.13.0", "requests-oauthlib>=0.7.0") +DEPENDENCIES = ("google-auth>=2.14.0", "requests-oauthlib>=0.7.0") with io.open("README.rst", "r") as fh: diff --git a/testing/constraints-3.6.txt b/testing/constraints-3.6.txt index 7decfc9..8d99e9d 100644 --- a/testing/constraints-3.6.txt +++ b/testing/constraints-3.6.txt @@ -5,6 +5,6 @@ # # e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev", # Then this file should have foo==1.14.0 -google-auth==2.13.0 +google-auth==2.14.0 requests-oauthlib==0.7.0 click==6.0.0 diff --git a/testing/constraints-3.7.txt b/testing/constraints-3.7.txt index 7decfc9..8d99e9d 100644 --- a/testing/constraints-3.7.txt +++ b/testing/constraints-3.7.txt @@ -5,6 +5,6 @@ # # e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev", # Then this file should have foo==1.14.0 -google-auth==2.13.0 +google-auth==2.14.0 requests-oauthlib==0.7.0 click==6.0.0 diff --git a/tests/unit/test_helpers.py b/tests/unit/test_helpers.py index a0fba03..20bf9c9 100644 --- a/tests/unit/test_helpers.py +++ b/tests/unit/test_helpers.py @@ -95,6 +95,7 @@ def test_credentials_from_session(session): assert credentials._client_id == CLIENT_SECRETS_INFO["web"]["client_id"] assert credentials._client_secret == CLIENT_SECRETS_INFO["web"]["client_secret"] assert credentials._token_uri == CLIENT_SECRETS_INFO["web"]["token_uri"] + assert credentials.scopes == session.scope def test_credentials_from_session_3pi(session): @@ -107,6 +108,9 @@ def test_credentials_from_session_3pi(session): client_secrets_info = CLIENT_SECRETS_INFO["web"].copy() client_secrets_info["3pi"] = True + client_secrets_info[ + "token_info_url" + ] = "https://accounts.google.com/o/oauth2/introspect" credentials = helpers.credentials_from_session(session, client_secrets_info) assert isinstance(credentials, external_account_authorized_user.Credentials) @@ -116,6 +120,10 @@ def test_credentials_from_session_3pi(session): assert credentials._client_id == CLIENT_SECRETS_INFO["web"]["client_id"] assert credentials._client_secret == CLIENT_SECRETS_INFO["web"]["client_secret"] assert credentials._token_url == CLIENT_SECRETS_INFO["web"]["token_uri"] + assert ( + credentials._token_info_url == "https://accounts.google.com/o/oauth2/introspect" + ) + assert credentials.scopes == session.scope def test_bad_credentials(session):