-
-
Notifications
You must be signed in to change notification settings - Fork 66
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
Github OAuth with non public email #32
Comments
@kairichard Yes, please. |
It would probably go in this direction - does that seem reasonable to you? class GithubPrivateEmail(GitHub):
def profile(self, **kwargs):
profile = super().profile(**kwargs)
if profile.get("email") is not None:
return profile
resp = self.get("user/emails")
resp.raise_for_status()
data = resp.json()
# There should only be one `primary`
profile["email"] = next(email["email"] for email in data if email["primary"])
return profile |
@kairichard how about just re-implement |
@lepture would also work yes, going to come back with a PR next week. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
UserInfo
object does not contain theemail
when requesting a non-public email with{'scope': 'user:email'}
. As a workaround, it is suggested to get the email with the token that was received see - https://stackoverflow.com/questions/35373995/github-user-email-is-null-despite-useremail-scopeA possible implementation would extend
GitHub.profile
withself.get("user/emails")
and use whatever is returned there in case the initial email isNone
. Would you accept PR on this?The text was updated successfully, but these errors were encountered: