Skip to content

Authorizing users via GitHub app, missing user emails. #24843

Answered by gylaz
gylaz asked this question in API and Webhooks
Discussion options

You must be logged in to vote

If anyone comes across this, I got some help from GitHub via another channel. Here’s the gist:

The omniauth-github gem that I’m using is depending on OAuth scopes to determine if it should ask for user emails:

def email_access_allowed?
return false unless options['scope']
email_scopes = ['user', 'user:email']
scopes = options['scope'].split(',')
(scopes & email_scopes).any?
end

If it doesn’t find the oauth scope it relies on the email found in the user profile which is a different user setting that defaults to not selected. A workaround to this would be to configure omniauth to request user:emailscope. It will be ignored by GitHub as GitHub Apps don’t use scopes but it would trigger omni…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@jclusso
Comment options

Answer selected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants