Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add oauth2 credentials #24

Merged
merged 2 commits into from
Oct 17, 2016
Merged

Add oauth2 credentials #24

merged 2 commits into from
Oct 17, 2016

Conversation

theacodes
Copy link
Contributor

No description provided.

@theacodes theacodes added this to the 1.0.0 milestone Oct 14, 2016
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.

from google.oauth2 import _client


class Credentials(credentials.Scoped, credentials.Credentials):

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

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.

This comment was marked as spam.

This comment was marked as spam.

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.

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.


@_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.

This comment was marked as spam.

from google.oauth2 import credentials


class TestCredentials:

This comment was marked as spam.

This comment was marked as spam.



class TestCredentials:
token_uri = 'https://example.com/oauth2/token'

This comment was marked as spam.

This comment was marked as spam.

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.


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.

@dhermes
Copy link
Contributor

dhermes commented Oct 16, 2016

LGTM, be sure to file the Credentials naming issue before merging

Copy link
Contributor Author

@theacodes theacodes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dhermes LGTY?

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.

from google.oauth2 import credentials


class TestCredentials:

This comment was marked as spam.

@theacodes
Copy link
Contributor Author

Oh I see you already said so, merging.

@theacodes theacodes merged commit 10ec7e9 into master Oct 17, 2016
@theacodes theacodes deleted the oauth2-credentials branch October 17, 2016 17:46
@theacodes theacodes mentioned this pull request Oct 21, 2016
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants