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 google.oauth2.flow - utility for doing OAuth 2.0 Authorization Flow #100

Merged
merged 5 commits into from
Jan 10, 2017

Conversation

theacodes
Copy link
Contributor

Resolves #74.

@theacodes theacodes requested a review from dhermes January 6, 2017 22:16
@@ -1,3 +1,7 @@
div.document {
width: 1040px;
}

This comment was marked as spam.

This comment was marked as spam.

@@ -370,6 +370,8 @@
'python': ('https://docs.python.org/3.5', None),
'urllib3': ('https://urllib3.readthedocs.io/en/stable', None),
'requests': ('http://docs.python-requests.org/en/stable', None),
'requests-oauthlib': (
'http://requests-oauthlib.readthedocs.io/en/stable', None),

This comment was marked as spam.

This comment was marked as spam.

flow = flow.Flow.from_client_secrets_file(
'path/to/client_secrets.json',
scopes=['profile', 'email'],
redirect_uri='urn:ietf:wg:oauth:2.0:oob')

This comment was marked as spam.

This comment was marked as spam.


# Create the flow using the client secrets file from the Google API
# Console.
flow = flow.Flow.from_client_secrets_file(

This comment was marked as spam.

This comment was marked as spam.

# Tell the user to go to the authorization URL.
auth_url, _ = flow.authorization_url(prompt='consent')

print('Please go to this URL: {}'.format(auth_url))

This comment was marked as spam.

This comment was marked as spam.


Returns:
Mapping[str, str]: The obtained tokens. Typically, you will not use
return value and use :meth:`credentials`.

This comment was marked as spam.

This comment was marked as spam.

@@ -0,0 +1,134 @@
# Copyright 2014 Google Inc.

This comment was marked as spam.

This comment was marked as spam.


from google.oauth2 import flow

DATA_DIR = os.path.join(os.path.dirname(__file__), '..', 'data')

This comment was marked as spam.

This comment was marked as spam.

assert instance.oauth2session.scope == mock.sentinel.scopes


@pytest.fixture

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.


import json

import requests_oauthlib

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@theacodes
Copy link
Contributor Author

No need to cast to a set (back to wasting RAM)

d'oh, fixed.

@theacodes theacodes merged commit 4382bc1 into master Jan 10, 2017
@theacodes theacodes deleted the oauthlib-flow branch January 10, 2017 21:35
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