-
Notifications
You must be signed in to change notification settings - Fork 407
Error when authenticated through OAuth without the user
scope
#797
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
Comments
This does indeed look like a real bug. Feels like we should be returning something like a AuthenticatedShortUser, or something like that. Whether or not we have a path to "upgrade" a ShortUser up to a full User is an interesting thought. I don't know if that really makes sense. Really ugly though that this method would return two different things, that's a pattern we don't actually like. |
I think that It is difficult to return something like a AuthenticatedShortUser because github's authenticated user information API returns two kinds of information. I hope this issue fix. So I created the pull requests #911. |
Hi,
According to the github documentation, the API return on
/user
is different when the user is authenticated through OAuth without theuser
scope from when it is authenticated with theuser
scope.https://developer.github.com/v3/users/#get-the-authenticated-user
But the library seems to handle only users with the
user
scope.When the
user
scope is not used, the api returns fewer fields: for instance, thedisk_usage
field is not returned, and when trying to load the return into anAuthenticatedUser
here:github3.py/github3/github.py
Lines 1004 to 1019 in bf44c16
I get the following error:
I think this function should not always try to load the result into an
AuthenticatedUser
, but first check the fields of the API's response and try to load aUser
if some fields are missing.Because of this behavior, we have to keep using the version 1.0.0a4 and cannot upgrade to version 1.0.1
If you think this is a valid issue, I can work on a pull request to fix it.
Thanks
The text was updated successfully, but these errors were encountered: