Skip to content

If scope is nil or 'public', skip email. #13

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

Merged
merged 1 commit into from
Aug 28, 2012

Conversation

igoodrich
Copy link
Contributor

If the scope is nil or 'public', github denies access to the email and
omniauth raises a failure. This makes it so that if you want to use
github for read-only authentication, you can't (at least in an obvious
fashion).

There is a workaround: pass 'skip_info: true' on configuration. In this
case you do not get the 'nickname' and 'image', however.
For example, the following will work without this fix:
provider :github, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET'], skip_info:
true

The other solution, without this patch, is to specify at least the user
scope, like so:
provider :github, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET'], scope:
'user'

If the scope is nil or 'public', github denies access to the email and
omniauth raises a failure.  This makes it so that if you want to use
github for read-only authentication, you can't (at least in an obvious
fashion).

There is a workaround: pass 'skip_info: true' on configuration.  In this
case you do not get the 'nickname' and 'image', however.
For example, the following will work without this fix:
provider :github, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET'], skip_info:
true

The other solution, without this patch, is to specify at least the user
scope, like so:
provider :github, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET'], scope:
'user'
@igoodrich
Copy link
Contributor Author

Hi, I tried to make this fit into the existing code as best I could. I hope it's okay. Please let me know if you have any questions about the issue. --Ian

@chalofa
Copy link

chalofa commented Jul 24, 2012

we are also facing this issue, using the gem through your git repo works, but would love to see this pull request merged

@prashantrajan
Copy link

Facing this same issue. Hoping this gets merged into master

@cjamison
Copy link

Ran into this issue as well.

@chalofa
Copy link

chalofa commented Aug 15, 2012

as a temp workaround, I'm using in my Gemfile:

gem 'crowdint_omniauth-github', :require => 'omniauth-github'

@jakeboxer
Copy link

Ran into the same problem. Hopefully this will get looked at soon; without it, this strategy is broken when the app uses public scope and the user has no public email address.

@moro
Copy link

moro commented Aug 23, 2012

I've just faced the same problem. Why this PR isn't merged?

@jakeboxer
Copy link

@mbleigh just pinging you on this real quick. Looks like quite a few people are hitting this problem.

mbleigh added a commit that referenced this pull request Aug 28, 2012
If scope is nil or 'public', skip email.
@mbleigh mbleigh merged commit f847333 into omniauth:master Aug 28, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants