Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Use primary email for the email field
The email provided by the user info in the response from /user is the
publicly visible email, which a user can choose to not set.

GitHub accounts always have a primary email, so let’s use that one
instead.
  • Loading branch information
zimme authored and martijnwalraven committed Jun 30, 2015
1 parent 7581cd3 commit 3833be8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/github/github_server.js
Expand Up @@ -5,12 +5,13 @@ OAuth.registerService('github', 2, null, function(query) {
var accessToken = getAccessToken(query);
var identity = getIdentity(accessToken);
var emails = getEmails(accessToken);
var primaryEmail = _.findWhere(emails, {primary: true});

return {
serviceData: {
id: identity.id,
accessToken: OAuth.sealSecret(accessToken),
email: identity.email,
email: primaryEmail.email,
username: identity.login,
emails: emails
},
Expand Down

0 comments on commit 3833be8

Please sign in to comment.