Omniauth facebook - Authentication Fields

I am trying to configure omniauth for a website to login via facebook. The problem is that facebook is not sending the "info" field.

I have 2 facebook apps for different conditions.

For one application, the answer has fields

#<OmniAuth::AuthHash credentials=#<OmniAuth::AuthHash expires=true expires_at=14 42913734 token="CAAU6NSaozowBANJoDeZCakDuUZAiIZBGQ5cmFYRTwQwo7SK2JK7uhcRK7WIadpp zjKfict9pMASS2k9XJZBTgnI8WJvJA42er9Xj8nuoeLjbEQo8TKB7b5hVlsOwRs5kcPpOPwyUTUc0ekF uu2w4ubNZBMXZBw5xjGkQwZBZA46fATGOvDXJSrWOOAiQteWnkSO9JkeZC2SfmZCQqcSR0zdV52"> ex tra=#<OmniAuth::AuthHash raw_info=#<OmniAuth::AuthHash id="xxxxxxxxxx" na me="xxxxxxx">> info=#<OmniAuth::AuthHash::InfoHash image="http://graph.facebo ok.com/xxxxxxxxxxx/picture" name="xxxx"> provider="facebook" uid="xxxxxxxx"> 

In env development, I get an answer

 #<OmniAuth::AuthHash credentials=#<OmniAuth::AuthHash expires=true expires_at=14 42912896 token="CAAPK1ZAgrDtEBAKKvcj4jGu6iaIxYYJV7LZCJ6MZCELZCgNyowkqPeB5kHBsVw4 ZBKoZCv4DD6my4s8qhO1hJyEFzcb1IpKt03ydzWORZCR3PCf1bw6A9jRudmcJn1N37WgqckmuKUj4k1y qb3fcRpNPxAxx0asXJlaUJTcVR5wi0sRIOc9l3yFm6XyuMA464MBz5vt9AvNcVB9DAGm5kHr"> extra =#<OmniAuth::AuthHash raw_info=#<OmniAuth::AuthHash email=" xxxxx@yahoo.co.in " first_name="xxxx" gender="male" id="xxxxx" last_name="xxxx" link="h ttps://www.facebook.com/app_scoped_user_id/xxxx/" locale="en_US" na me="xxxx" timezone=10 updated_time="2015-06-06T03:35:33+0000" verified=tru e>> info=#<OmniAuth::AuthHash::InfoHash email="xxxxxxx" first_name=" xx" image="http://graph.facebook.com/xxx/picture" last_name="xxxxx" name="xxxxx" urls=#<OmniAuth::AuthHash Facebook="https://www.facebook.c om/app_scoped_user_id/xxxxx/"> verified=true> provider="facebook" ui d="xxxxxxxxxxxxxxxx"> 

I wonder if this is an application level setting because the code is the same for both. Only the difference on the application side is API v2.3 and the other 2.4.

+5
source share
1 answer

There is a difference when you use v2.3 and v2.4.

In your config/initializers/devise.rb or wherever you put your API key, you need to add info_fields except scope ,

Example

 config.omniauth :facebook, APP["facebook_id"], APP["facebook_secret"], :scope => 'email,public_profile', info_fields: 'email,name' 
+8
source

All Articles