ruby on rails - omniauth-facebook does not return set scope -
in omniauth.rb
omniauth.config.logger = rails.logger rails.application.config.middleware.use omniauth::builder 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
client side, javascript:
return fb.login(function(response) { if (response.authresponse) { return window.location = '/auth/facebook/callback; } }, {scope: 'email,public_profile'});
as per fb api docs.
when fb popup opens ask permissions, correctly asks email , public_profile. hit ok , request.env['omniauth.auth]
provides me only:
{"provider":"facebook","uid":"xxxxxxx","info":{"name":"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"}}}
i see neither email address nor public info except full name , profile picture.
i have no clue i'm doing wrong follow guidelines of omniauth-facebook gem here: https://github.com/mkdynamic/omniauth-facebook , fb developer docs.
any hints?
you on right path need update info fields fields want pull facebook, public_profile won't work
rails.application.config.middleware.use omniauth::builder provider :facebook, rails.application.secrets[:facebook_app_id], rails.application.secrets[:facebook_secret], :scope => 'email', :display => 'popup', :info_fields => 'email,first_name,last_name' end
Comments
Post a Comment