ruby on rails - omniauth.auth for Facebook not returning full hash and not able to successfully login with facebook -


i'm working on facebook clone project http://www.theodinproject.com/ruby-on-rails/final-project.

i'm stuck omniauth-facebook portion, , i'm not able login facebook. think problem might due request.env["omniauth.auth"]. when try raise request.env["omniauth.auth"].to_yaml. following incomplete hash. it's missing lot of information such first_name, last_name, gender, etc.

--- !ruby/hash:omniauth::authhash provider: facebook uid: &#39;10206926404981253&#39; info: !ruby/hash:omniauth::authhash::infohash   name: thomas pan   image: http://graph.facebook.com/10206926404981253/picture credentials: !ruby/hash:omniauth::authhash   token: <token>   expires_at: 1442277104   expires: true extra: !ruby/hash:omniauth::authhash   raw_info: !ruby/hash:omniauth::authhash     name: thomas pan     id: <id> 

** replaced info <> security.

i'm using along devise well.

everything else seems set correctly i've followed instructions here devise , omniauth-facebook. https://github.com/plataformatec/devise/wiki/omniauth:-overview

user.rb

devise :database_authenticatable, :registerable,    :recoverable, :rememberable, :trackable, :validatable,    :omniauthable, :omniauth_providers => [:facebook]  def self.from_omniauth(auth)   where(provider: auth.provider, uid: auth.uid).first_or_create |user|     user.email = auth.info.email     user.password = devise.friendly_token[0,20]     user.first_name = auth.info.first_name     user.last_name = auth.info.last_name     user.gender = auth.extra.raw.gender   end   end   

devise.rb

config.omniauth :facebook, env['fb_app_id'], env['fb_app_secret'] 

routes.rb

devise_for :users, :controllers => { :registrations => "users/registrations", :omniauth_callbacks => "users/omniauth-callbacks" } 

omniauth_callbacks_controller.rb

def facebook   raise request.env['omniauth.auth'].to_yaml   end end 

any assistance appreciated!

version info: rails 4.2.1 ruby 2.0.0

in devise.rb:

config.omniauth :facebook, env['fb_app_id'], env['fb_app_secret'], scope: 'email', info_fields: 'email,name,first_name,last_name,gender' 

Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -