ueberauth / ueberauth_github

GitHub OAuth2 Strategy for Überauth
MIT License
103 stars 53 forks source link

fetching github user private email #10

Closed trungpham closed 7 years ago

trungpham commented 8 years ago

In some instance, the user does not enable public email address, then the code will blow up as described in #9

If the public email address is nil, then we should make a follow up api call to retrieve the private email address instead.

https://developer.github.com/v3/users/emails/#list-email-addresses-for-a-user

doomspork commented 8 years ago

@trungpham please feel free to make these changes, PRs are welcomed!

andersklenke commented 8 years ago

Very nice @mgwidmann!

bcat-eu commented 7 years ago

After this change is merged there will be another issue: users with private addresses now have their emails under emails key and in info, but not on the main struct so there seem to be no way to use something like uid_field: "email" to map email to uid.

One way of fixing it would handling the "email" key as a special case in uid function, here is my temporary solution: https://github.com/bcat-eu/ueberauth_github/commit/54003d5367fe961598a51495a5e224aac559c7b2

Another alternative would be allowing a callback as config value but that might get too complicated to use.