-
Notifications
You must be signed in to change notification settings - Fork 219
make oauth2 token refresh more multi-process-friendly #72
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
Conversation
walgitrus
commented
Sep 16, 2015
- add optional retrieve_tokens callback to OAuth2 to fetch possibly refreshed tokens from local store
- addresses issue Token Refresh in a Multiple Process Environment #71
|
Verified that @walgitrus has signed the CLA. Thanks for the pull request! |
d1cd973 to
f51c2a4
Compare
|
looks like |
|
Thanks for the PR. First look through looks good. We'll fix the cryptography issue (there's a fix in #70, though I might try something else), and then look to merge this. |
|
I merged a fix for the PyPy issue. Going to close and re-open this PR to try to get Travis to generate the new test matrix. |
f51c2a4 to
18fc5d5
Compare
|
rebased to pull in the changes from master |
boxsdk/auth/oauth2.py
Outdated
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.
Since this is similar to store_tokens (and they'll probably be used together), let's put this below store_tokens in the argument list. Same in the docstring.
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.
changes made and pushed
- add optional retrieve_tokens callback to OAuth2 to fetch possibly refreshed tokens from local store
18fc5d5 to
a880cc3
Compare
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.
Let's expand on this slightly.
We should specify that the callback takes no arguments, and that it should either return None (if no credentials are currently stored), or a (access token, refresh token) tuple.
And maybe we should add a brief description of what this feature would be used for. Something like "When using multiple processes or multiple separate OAuth2 objects, provide a retrieve_tokens function so that the same credentials can be reused across all your OAuth2 objects. The first object that needs to authenticate will do so, and store the tokens with the store_tokens callback (or the authentication and storage might happen entirely outside of the SDK). All subsequent objects, rather than re-authenticating, will use the tokens provided by retrieve_tokens. And the same behavior will occur when they all need to do token refresh." Feel free to reword or make that more concise.
|
Hi @walgitrus, We're going to handle this in PR #81 (see the |