Skip to content
This repository was archived by the owner on Feb 24, 2026. It is now read-only.

Implement code verifier (PKCE)#42

Merged
tseaver merged 7 commits intogoogleapis:masterfrom
jay0lee:master
May 29, 2019
Merged

Implement code verifier (PKCE)#42
tseaver merged 7 commits intogoogleapis:masterfrom
jay0lee:master

Conversation

@jay0lee
Copy link
Copy Markdown
Contributor

@jay0lee jay0lee commented May 23, 2019

This PR adds support for PKCE code verification as documented at:

https://developers.google.com/identity/protocols/OAuth2InstalledApp#step1-code-verifier

note that I'm currently using secrets module which is Python 3.6+. I couldn't find anything that documented minimum Python version requirements for this project but if it is something older I'm happy to try and make the PR backwards compatible with it.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label May 23, 2019
@tseaver
Copy link
Copy Markdown

tseaver commented May 23, 2019

@jay0lee This library currently supports Python 2.7, 3.4, 3.5, 3.6, and 3.7. Dropping 3.4 support is probably OK immediately, but 2.7 needs to stick around until at least EOY, and 3.5 until September 2020 (when its EOL happens).

@jay0lee
Copy link
Copy Markdown
Contributor Author

jay0lee commented May 23, 2019

OK, will see about getting it working on 2.7. I also failed to update all the tests :-)

Comment thread google_auth_oauthlib/flow.py Outdated
Comment thread tests/test_flow.py
with authorization_url_path as authorization_url_spy:
url, _ = instance.authorization_url()

_, kwargs = authorization_url_spy.call_args_list[0]
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The mock has an assert_called_once_with helper for this, e.g.:

    authorization_url_spy..assert_called_once_with(code_challenge_method='S256')

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

thanks, I can do this for checking code_challenge_method but the other values are randomized and I'm just doing size and character type validations but I think I need to unpack the arguments to do those regex comparisons.

Definitely open to suggestions here. Thanks.

@jay0lee
Copy link
Copy Markdown
Contributor Author

jay0lee commented May 29, 2019

Tests are now passing, any further steps I need to take here?

@tseaver tseaver merged commit e56853e into googleapis:master May 29, 2019
@tseaver
Copy link
Copy Markdown

tseaver commented May 29, 2019

@jay0lee Thanks for your efforts!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants