spree-contrib / spree_social

Building block for spree social networking features (provides authentication and account linkage)
http://guides.spreecommerce.org
BSD 3-Clause "New" or "Revised" License
213 stars 283 forks source link

Facebook doesn't always return an email address, but Spree assumes it does. #164

Open ghost opened 9 years ago

ghost commented 9 years ago

In the apply_omniauth method we asssume we can get an email out of what FB returns. If there is not one perhaps we should throw an error so we can tell the user 'Hey, FB didn't provide your email, please use another method' Right now the user just gets the 'one more step' error message which isn't that helpful.

ghost commented 9 years ago

Only seeing this on API 2.4, 2.0 seems to be fine.

krzysiek1507 commented 8 years ago

@tesserakt API 2.4 doesn't return email as default.

habib136888 commented 8 years ago

Any solutions for this. I dont see it returning email address for me. Where as other ecommerce site are saving my email.

krzysiek1507 commented 8 years ago

@habib136888 you can monkey patch method request_phase https://github.com/spree-contrib/spree_social/blob/3-0-stable/lib/spree_social/engine.rb

OmniAuth::Strategies::Facebook.class_eval do
  def request_phase
    options[:scope] ||= 'email'
    options[:info_fields] ||= 'name,email'
    options[:display] = mobile_request? ? 'touch' : 'page'
    super
  end
end