Skip to content

Add Support for PKCE #187

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 2 commits into from
Apr 2, 2020
Merged

Add Support for PKCE #187

merged 2 commits into from
Apr 2, 2020

Conversation

rogebrd
Copy link
Contributor

@rogebrd rogebrd commented Apr 1, 2020

  • Add Support for PKCE in OAuth Flow
  • Add unit tests for oauth flow
  • Add example for command line with PKCE
  • Make client secret optional for PKCE

@rogebrd rogebrd requested a review from jiuyangzhao April 1, 2020 22:53
dropbox/oauth.py Outdated
def __init__(self, consumer_key, consumer_secret, locale=None, token_access_type='legacy',
scope=None, include_granted_scopes=None):
def __init__(self, consumer_key, consumer_secret=None, locale=None, token_access_type='legacy',
scope=None, include_granted_scopes=None, pkce_method=None):

Choose a reason for hiding this comment

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

I think it make no sense to ever provide plain here. We should always use s256.

And still leave a boolean like "use_pkce"

dropbox/oauth.py Outdated
def __init__(self, consumer_key, consumer_secret, locale=None, token_access_type='legacy',
scope=None, include_granted_scopes=None):
def __init__(self, consumer_key, consumer_secret=None, locale=None, token_access_type='legacy',
scope=None, include_granted_scopes=None, pkce_method=None):
if scope is not None:
assert len(scope) > 0 and isinstance(scope, list), \

Choose a reason for hiding this comment

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

BTW I think it is time to point out that.

Assertion Error should be use when you are absolutely sure that the input can't be False. For this type of user error, we should throw other exceptions.

dropbox/oauth.py Outdated
@@ -412,10 +456,19 @@ def __init__(self, consumer_key, consumer_secret, redirect_uri, session,
user - include user scopes in the grant
team - include team scopes in the grant
Note: if this user has never linked the app, include_granted_scopes must be None
:param str pkce_method: method for code_challenge generation if using PKCE

Choose a reason for hiding this comment

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

Again I feel we should just use a boolean here:

And the doc string should be more lean toward something like: "PKCE should be only use on client apps which doesn't call your server. It is less secure than non-PKCE flow".

@rogebrd rogebrd merged commit 9c3302a into master Apr 2, 2020
@rogebrd rogebrd deleted the pkce_support branch April 2, 2020 20:05
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