Rails 5 devise omniauth-facebook Error: Sorry, something went wrong

China☆狼群 提交于 2019-12-12 13:49:32

问题


I am following Devise's official guide from top to this section. My CALLBACK_URL is http://localhost:3000/users/auth/facebook/callback, which I think might be the problem but I'm not sure. When I click on Sign in with Facebook, I run into this error:
Sorry, something went wrong.
on this link:
https://www.facebook.com/v2.6/dialog/oauth?client_id=193217371133539&redirect_uri=https%3A%2F%2Flocalhost%3A3000%2Fusers%2Fauth%2Ffacebook%2Fcallback&response_type=code&scope=user%2Cpublic_repo&state=3913c12e0e4ce8b422732c9159c0fb1fb7351d100487849d

Rails version: Rails 5.0.0.1
Ruby version(using rbenv): ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin16]


回答1:


For anyone still having this issue, then check your scope, as Akash and Bodacious state above, and modify it to look like this:

scope: 'email', info_fields: 'email,name'

This will allow you to get the email field.




回答2:


I found this https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview

Facebook returning nulled email

Since July 8th 2015 Facebook changed to api v2.4, you need to add extra info_fields to get email field.

config.omniauth :facebook, "APP_ID", "APP_SECRET", scope: 'email', info_fields: 'email,name'

found solution from here by @techmonster



来源:https://stackoverflow.com/questions/40290287/rails-5-devise-omniauth-facebook-error-sorry-something-went-wrong

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!