Ruby on Rails Omniauth facebook doesn't return email

后端 未结 5 1001
广开言路
广开言路 2020-12-19 06:07

I have been trying for days to setup my Omniauth for facebook I don\'t know what am I doing wrong.

I am not able to get the email of the user. The returned hash only

5条回答
  •  独厮守ぢ
    2020-12-19 06:47

    You need to request the permissions. For example, to request email, user_birthday and read_stream permissions and display the authentication page in a popup window:

    Rails.application.config.middleware.use OmniAuth::Builder do
      provider :facebook, ENV['FACEBOOK_KEY'], ENV['FACEBOOK_SECRET'],
           :scope => 'email,user_birthday,read_stream', :display => 'popup'
    end
    

    Please check this Omniauth-facebook if you have any doubts.

提交回复
热议问题