Skip to content

Commit

Permalink
fix: include updates to properties from Google Auth lib (#249)
Browse files Browse the repository at this point in the history
* Include updates to properties from Google Auth lib

* test for scopes

* updating real deps
  • Loading branch information
ScruffyProdigy authored Nov 3, 2022
1 parent dfaa869 commit 58becac
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions google_auth_oauthlib/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion testing/constraints-3.6.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion testing/constraints-3.7.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 8 additions & 0 deletions tests/unit/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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)
Expand All @@ -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):
Expand Down

0 comments on commit 58becac

Please sign in to comment.