Skip to content

Add Support for Scopes #185

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

Merged
merged 3 commits into from
Apr 1, 2020
Merged

Add Support for Scopes #185

merged 3 commits into from
Apr 1, 2020

Conversation

rogebrd
Copy link
Contributor

@rogebrd rogebrd commented Mar 30, 2020

  • Add option for requesting specific scopes and including already granted scopes in pauth flow
  • Add support for default scope list in Dropbox client
  • Add support for requesting specific scopes on token refresh
  • Update oauth command line documentation to work with python3
  • Update tox.ini to run pytest instead of outdated python setup.py test
  • Add venv to .gitignore

- Add option for requesting specific scopes and including already granted scopes in pauth flow
- Add support for default scope list in Dropbox client
- Add support for requesting specific scopes on token refresh
- Update oauth command line documentation to work with python3
- Update tox.ini to run pytest instead of outdated python setup.py test
- Add venv to .gitignore
@rogebrd rogebrd requested a review from jiuyangzhao March 30, 2020 23:02
@rogebrd rogebrd mentioned this pull request Mar 30, 2020
dropbox/oauth.py Outdated
@@ -108,14 +120,22 @@ def __repr__(self):

class DropboxOAuth2FlowBase(object):

def __init__(self, consumer_key, consumer_secret, locale=None, token_access_type='legacy'):
def __init__(self, consumer_key, consumer_secret, locale=None, token_access_type='legacy',
scope_list=None, include_granted_scopes=None):

Choose a reason for hiding this comment

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

I suggest you name it scope to make it consistent with OAuth2 Spec

dropbox/oauth.py Outdated
@@ -163,6 +189,11 @@ def _finish(self, code, redirect_uri):
else:
expires_in = None

if 'scope' in d:
scope_list = d

Choose a reason for hiding this comment

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

scope_list = d["scope"]

Choose a reason for hiding this comment

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

This reveals that we might need some test coverage on finish method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, changed and can add some coverage

@@ -0,0 +1,26 @@
#!/usr/bin/env python3

Choose a reason for hiding this comment

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

Worth adding document right now. Saying that this example is only for certain partners.

Otherwise this might confuse people. The example/readme part in Github is educational. So we want to make sure they are as clear as possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually will change this to a working example so people can use it today

Choose a reason for hiding this comment

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

Cool

super(DropboxOAuth2Flow, self).__init__(consumer_key, consumer_secret,
locale, token_access_type)
super(DropboxOAuth2Flow, self).__init__(consumer_key, consumer_secret, locale,
token_access_type, scope,

Choose a reason for hiding this comment

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

I suggest passing kwargs with keyword

@rogebrd rogebrd merged commit 129035e into master Apr 1, 2020
@rogebrd rogebrd deleted the scope_support branch April 1, 2020 18:07
@rogebrd rogebrd linked an issue Apr 6, 2020 that may be closed by this pull request
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.

Sample code outdated
2 participants