在我omniauth.rbomniauth,Facebook並沒有返回設置範圍
OmniAuth.config.logger = Rails.logger
Rails.application.config.middleware.use OmniAuth::Builder do
provider :facebook, Rails.application.secrets[:facebook_app_id], Rails.application.secrets[:facebook_secret], :scope => 'email,public_profile', :display => 'popup', :info_fields => 'email,public_profile'
end
客戶端,JavaScript:
return FB.login(function(response) {
if (response.authResponse) {
return window.location = '/auth/facebook/callback;
}
}, {scope: 'email,public_profile'});
爲每FB API文檔。
當FB彈出窗口打開以詢問權限時,它正確地請求電子郵件和public_profile。我打OK,這就是request.env['omniauth.auth]
爲我提供了唯一的:
{ 「提供者」: 「臉譜」, 「UID」: 「XXXXXXX」, 「信息」:{ 「名」: 「XXXXXXX XXXXXXX」 ,「image」:「http://graph.facebook.com/XXXXXXX/picture」},「credentials」:{「token」:「XXXXXXX」,「expires_at」:1444467600,「expires」:true},「extra」:{「raw_info」:{「name」 「XXXXXXX XXXXXXX」,「ID」:「XXXXXXX」}}}
我既沒有看到電子郵件地址,也沒有除了全名和個人資料圖片任何公開信息。
我不知道我在做什麼錯誤,因爲我完全遵循omniauth-facebook gem的指導:https://github.com/mkdynamic/omniauth-facebook以及FB開發人員文檔。
任何提示?