Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Commit 2d0549a

Browse files
author
Jon Wayne Parrott
authored
Add public properties to google.oauth2.credentials.Credentials (#124)
1 parent 3459d31 commit 2d0549a

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

google/oauth2/credentials.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,27 @@ def __init__(self, token, refresh_token=None, token_uri=None,
6868
self._client_id = client_id
6969
self._client_secret = client_secret
7070

71+
@property
72+
def refresh_token(self):
73+
"""Optional[str]: The OAuth 2.0 refresh token."""
74+
return self._refresh_token
75+
76+
@property
77+
def token_uri(self):
78+
"""Optional[str]: The OAuth 2.0 authorization server's token endpoint
79+
URI."""
80+
return self._token_uri
81+
82+
@property
83+
def client_id(self):
84+
"""Optional[str]: The OAuth 2.0 client ID."""
85+
return self._client_id
86+
87+
@property
88+
def client_secret(self):
89+
"""Optional[str]: The OAuth 2.0 client secret."""
90+
return self._client_secret
91+
7192
@property
7293
def requires_scopes(self):
7394
"""False: OAuth 2.0 credentials have their scopes set when

tests/oauth2/test_credentials.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ def test_default_state(self):
4141
assert not self.credentials.expired
4242
# Scopes aren't required for these credentials
4343
assert not self.credentials.requires_scopes
44+
# Test properties
45+
assert self.credentials.refresh_token == self.REFRESH_TOKEN
46+
assert self.credentials.token_uri == self.TOKEN_URI
47+
assert self.credentials.client_id == self.CLIENT_ID
48+
assert self.credentials.client_secret == self.CLIENT_SECRET
4449

4550
def test_create_scoped(self):
4651
with pytest.raises(NotImplementedError):

0 commit comments

Comments
 (0)