-
Notifications
You must be signed in to change notification settings - Fork 809
PKCE support with oauthlib 3 #678
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
PKCE support with oauthlib 3 #678
Conversation
…th-toolkit into PKCE-support-with-oauthlib-3
Pull Request Test Coverage Report for Build 1080
💛 - Coveralls |
could anyone check why the build is failing? |
Seems to be because of my attempt to support oauthlib 3 unofficially. |
I'll fix it once I get a hold of my pc |
ping me after making travis green. |
https://github.com/oauthlib/oauthlib/releases seems 3.0.1 is the latest |
Any progress? Would love to use this in our new app! |
Same here. We're anxiously waiting for this to be able to supply our vendors with the ability to use PKCE. |
@auvipy Sorry it took so long. Fixed the migration and pulled from master. Should be ready to merge now. |
really great work! thanks for tackling this and reviewers for reviewing. |
Thanks guys! Awesome work :-) 👍 |
"code_challenge_method": code_challenge_method, | ||
} | ||
|
||
response = self.client.post(reverse("oauth2_provider:authorize"), data=authcode_data) |
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 had a quick question about this. Shouldn't this be a GET request? I get csrf errors when I send POST. I have been trying to get PKCE to run against master but couldn't get it to work. I would appreciate any pointers no how to get it working.
Edit: many tests fail when I change it to get
. I would love to work on this unless it would be a faster fix for OP.
Yes, GET and optionally POST.
https://tools.ietf.org/html/rfc6749#section-3.1
…On Fri, Apr 19, 2019 at 4:58 AM Abhishek Patel ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In tests/test_authorization_code.py
<#678 (comment)>
:
> + """
+ Helper method to retrieve a valid authorization code using pkce
+ """
+ oauth2_settings.PKCE_REQUIRED = True
+ authcode_data = {
+ "client_id": self.application.client_id,
+ "state": "random_state_string",
+ "scope": "read write",
+ "redirect_uri": "http://example.org",
+ "response_type": "code",
+ "allow": True,
+ "code_challenge": code_challenge,
+ "code_challenge_method": code_challenge_method,
+ }
+
+ response = self.client.post(reverse("oauth2_provider:authorize"), data=authcode_data)
I had a quick question about this. Shouldn't this be a GET request? I have
been trying to get pkce to run against master but couldn't get it to work.
I would appreciate any pointers no how to get it working.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#678 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABBHS52XI5JMSTPN3NGDN7DPRGCU7ANCNFSM4GKUGSNA>
.
|
Here are the two issues I ran into:
1. GET requests fail, both in tests and actual endpoint usage.
2. POST fails due to csrf tokens missing, and I think tests should have
checked for it. Should the tests be checking for this or is it entirely
intentional to skip that?
I think having POST requests will be more secure in that browsers won't
store our code challenges in history, however removing CSRF protection
might introduce bigger issues.
However the spec says GET should work too. So can I open an issue to have
PXCE working on GET requests; and work (get assigned) on it?
On Fri, Apr 19, 2019, 4:49 AM Alan Crosswell <notifications@github.com
wrote:
… Yes, GET and optionally POST.
https://tools.ietf.org/html/rfc6749#section-3.1
On Fri, Apr 19, 2019 at 4:58 AM Abhishek Patel ***@***.***>
wrote:
> ***@***.**** commented on this pull request.
> ------------------------------
>
> In tests/test_authorization_code.py
> <
#678 (comment)
>
> :
>
> > + """
> + Helper method to retrieve a valid authorization code using pkce
> + """
> + oauth2_settings.PKCE_REQUIRED = True
> + authcode_data = {
> + "client_id": self.application.client_id,
> + "state": "random_state_string",
> + "scope": "read write",
> + "redirect_uri": "http://example.org",
> + "response_type": "code",
> + "allow": True,
> + "code_challenge": code_challenge,
> + "code_challenge_method": code_challenge_method,
> + }
> +
> + response = self.client.post(reverse("oauth2_provider:authorize"),
data=authcode_data)
>
> I had a quick question about this. Shouldn't this be a GET request? I
have
> been trying to get pkce to run against master but couldn't get it to
work.
> I would appreciate any pointers no how to get it working.
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <
#678 (review)
>,
> or mute the thread
> <
https://github.com/notifications/unsubscribe-auth/ABBHS52XI5JMSTPN3NGDN7DPRGCU7ANCNFSM4GKUGSNA
>
> .
>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#678 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABKEVQNNI2LUVDJKXX4KXNDPRGWVZANCNFSM4GKUGSNA>
.
|
This is odd. This pull request does not change anything related to how the requests are handled. It only adds new fields to the existing ones. Would you mind sharing how you are making the requests? |
I simply enter the prepared url in browser. Although, the app is
registered as public app and pkce setting is set to true.
I can provide a more thorough way to recreate it by end of today or
tomorrow. I'll also double check to make sure I'm not messing something on
my side.
…On Fri, Apr 19, 2019, 9:06 AM Gustavo Maronato ***@***.*** wrote:
This is odd. This pull request does not change anything related to how the
requests are handled. It only adds new fields to the existing ones. Would
you mind sharing how you are making the requests?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#678 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABKEVQPYFRLH3W34U4ZMFH3PRHUZZANCNFSM4GKUGSNA>
.
|
I just tested it and you are correct. I was under the impression that oauthlib would capture PKCE credentials, but it doesn't. I've submitted a PR fixing the issue: #707 |
Awesome! That was quick!
…On Fri, Apr 19, 2019, 10:19 AM Gustavo Maronato ***@***.*** wrote:
I just tested it and you are correct. I was under the impression that
oauthlib would capture PKCE credentials, but it doesn't. I've submitted a
PR fixing the issue: #707
<#707>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#678 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABKEVQOWW2SETCB3EY2UTV3PRH5JXANCNFSM4GKUGSNA>
.
|
This PR modifies #656's implementation to use oauthlib's built-in support for PKCE.
Since this version of oauthlib is based on version 3, I had to modify some test cases to comply with the changes.
I also modified the tox and setup files to use the new version of oauthlib.
All modifications to the base test cases and tox/setup files are contained in a491bb1.