ruby - Rails omniauth get a real facebook profile link -


i want real facebook link. after authentication omniauth gem, i've linked this: https://www.facebook.com/app_scoped_user_id/960601127305294/ real profile link is: https://www.facebook.com/kuzevanoff

so system, there 2 different links.

how can solve problem?

thanks!

my omniauth hash:

started "/auth/facebook" 127.0.0.1 @ 2015-05-31 13:40:45 +0200 i, [2015-05-31t13:40:45.979688 #56787]  info -- omniauth: (facebook) request phase initiated.  <omniauth::authhash credentials=#<omniauth::authhash expires=true expires_at=1438249229 token="caaxpwjr1v5obabodmqtupagyphnmbo3v7q0jifa8c7zayvvxyqijoayda1zjdeb6x9gq8trjfkeuezas003mnee2mseo09uqwy3uvrs2jpodvqiauqrzaxufbhbw234bb9s4q31wkpeombezzbfmnp1cpowo3uwtohfsfqfjobipszckfplzajbh3rp6fl6ldl62juclhdsiu7xubwptvt"> extra=#<omniauth::authhash raw_info=#<omniauth::authhash email="boriska-iriska@yandex.ru" first_name="boris" gender="male" id="960601127305294" last_name="kuzevanov" link="https://www.facebook.com/app_scoped_user_id/960601127305294/" locale="ru_ru" name="boris kuzevanov" timezone=2 updated_time="2015-05-03t21:09:59+0000" verified=true>> info=#<omniauth::authhash::infohash email="boriska-iriska@yandex.ru" first_name="boris" image="http://graph.facebook.com/960601127305294/picture" last_name="kuzevanov" name="boris kuzevanov" urls=#<omniauth::authhash facebook="https://www.facebook.com/app_scoped_user_id/960601127305294/"> verified=true> provider="facebook" uid="960601127305294"> 

if you're using omniauth-facebook gem, following auth hash request.env['omniauth.auth']

# example omniauth-facebook gem # https://github.com/mkdynamic/omniauth-facebook#auth-hash {   :provider => 'facebook',   :uid => '1234567',   :info => {     :nickname => 'jbloggs',     :email => 'joe@bloggs.com',     :name => 'joe bloggs',     :first_name => 'joe',     :last_name => 'bloggs',     :image => 'http://graph.facebook.com/1234567/picture?type=square',     :urls => { :facebook => 'http://www.facebook.com/jbloggs' },     :location => 'palo alto, california',     :verified => true   },   # removed non-essential part brevity.. } 

as can see profile url avialble via info > urls > facebook. also, can append nickname root url profile link.

"http://www.facebook.com/" + omniauth_hash.info.nickname 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -