Conversation
google/oauth2/credentials.py
Outdated
| optional `refresh token`_. | ||
|
|
||
| Obtaining the initial access and refresh token is outside of the scope of this | ||
| module. Consult `rfc6749 section 4.1` for complete details on the Authorization |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| from google.oauth2 import _client | ||
|
|
||
|
|
||
| class Credentials(credentials.Scoped, credentials.Credentials): |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| def __init__(self, token, refresh_token=None, token_uri=None, | ||
| client_id=None, client_secret=None, scopes=None): | ||
| """ | ||
| Args: |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
google/oauth2/credentials.py
Outdated
| client_secret(str): The OAuth 2.0 client secret. Must be specified | ||
| for refresh, can be left as None if the token can not be | ||
| refreshed. | ||
| scopes (Union[str, Sequence]): The scopes that were originally used |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| can not request additional scopes after authorization. | ||
| """ | ||
| super(Credentials, self).__init__() | ||
| self.token = token |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| @_helpers.copy_docstring(credentials.Credentials) | ||
| def refresh(self, request): | ||
| access_token, refresh_token, expiry, _ = _client.refresh_grant( |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
tests/oauth2/test_credentials.py
Outdated
| from google.oauth2 import credentials | ||
|
|
||
|
|
||
| class TestCredentials: |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
tests/oauth2/test_credentials.py
Outdated
|
|
||
|
|
||
| class TestCredentials: | ||
| token_uri = 'https://example.com/oauth2/token' |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
tests/oauth2/test_credentials.py
Outdated
| self.credentials = credentials.Credentials( | ||
| token=None, refresh_token='refresh_token', | ||
| token_uri=self.token_uri, client_id='client_id', | ||
| client_secret='client_secret') |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
tests/oauth2/test_credentials.py
Outdated
|
|
||
| def test_create_scoped(self): | ||
| with pytest.raises(NotImplementedError): | ||
| assert credentials == self.credentials.with_scopes('email') |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
LGTM, be sure to file the |
| def __init__(self, token, refresh_token=None, token_uri=None, | ||
| client_id=None, client_secret=None, scopes=None): | ||
| """ | ||
| Args: |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
tests/oauth2/test_credentials.py
Outdated
| from google.oauth2 import credentials | ||
|
|
||
|
|
||
| class TestCredentials: |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
Oh I see you already said so, merging. |
No description provided.