-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Git service: attach each service to an allauth provider #11995
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
With #11942, a GH app is used to interact with the GH API, a GH app is not directly tied to a user, so this assumption is not valid anymore. For most of the operations (except for syncing repos), we don't need to know who is the user that is performing the action, we just need to know the project that is being affected.
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.
Looks great overall, just a couple questions.
token_config.update( | ||
{ | ||
"refresh_token": token.token_secret, | ||
"expires_in": token_expires, |
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'm a little surprised we're setting this internally -- is it so we can update it if needed?
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.
yeah, allauth doesn't provide an oauth2 client, so we use requests_oauthlib, and we need to glue the token from allauth other lib. Most of this code was just moved.
""" | ||
Update token given data from OAuth response. | ||
|
||
Expect the following response into the closure:: |
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.
Not sure what this is saying -- do you mean that is the expected value of the token
arg?
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.
Nope, this is likely the response you get when the request for a new token is made.
log.info("Updated token.", token_id=token.pk) | ||
|
||
return _updater | ||
@cached_property |
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.
What is caching doing here? Seems a little scary to cache an object like this? Could probably use a comment at least explaining why we aren't just setting this in the __init__
as self.session
?
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.
This is the same as we used to have (cache the client at the instance level), but we were manually caching the object.
readthedocs.org/readthedocs/oauth/services/base.py
Lines 164 to 167 in 2c963f1
def get_session(self): | |
if self.session is None: | |
self.create_session() | |
return self.session |
Suspect IssuesThis pull request was deployed and Sentry observed the following issues:
Did you find this useful? React with a 👍 or 👎 |
This is on top of #11983