-
Notifications
You must be signed in to change notification settings - Fork 329
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
Add Support for PKCE #187
Conversation
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
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): |
There was a problem hiding this comment.
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), \ |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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".