Omniauth Facebook not returning email and gender rails 4 -


i need fetch name, email, image , gender facebook. getting name , image, email , gender not fetched facebook. struggling past 2 days, can me out here.

user model:

def self.from_omniauth(auth)   where(provider: auth.provider, uid: auth.uid).first_or_initialize.tap |user|            user.provider = auth.provider     user.uid = auth.uid     user.name = auth.info.name     user.email = auth.info.email     user.gender = auth.extra.raw_info.gender #if user.gender.blank?     user.image = auth.info.image             user.save!   end end 

omniauth.rb

omniauth.config.logger = rails.logger     rails.application.config.middleware.use omniauth::builder  if rails.env.production?   provider :facebook, 'app_id', 'app_sec' elsif rails.env.development?   provider :facebook, 'app_id', 'app_sec', {:scope => 'publish_actions,email', :client_options => { :ssl => { :ca_file => "#{rails.root}/config/ca-bundle.crt" }}} else     provider :facebook, 'app_id', 'app_sec' end   end 

if use user.gender = auth.extra.raw.gender if user.gender.blank? returns null.

even have checked facebook privacy settings in public profiles only. can please me out here

add these changes data:

provider :facebook, 'app_id', 'app_sec_key', {:scope => 'email', :info_fields => 'email,name,first_name,last_name,gender', :client_options => { :ssl => { :ca_file => "#{rails.root}/config/ca-bundle.crt" }}} 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -