Facebook App using Devise is redirecting away from FB Canvas

巧了我就是萌 提交于 2019-12-25 02:15:37

问题


When the user installs my facebook app for the first time, a facebook logo is displayed, permissions are requested, and then the user is popped out of the iframe.

I applied the directions recently (Oct 14th) added to the OmniAuth Overview wiki page on the devise site regarding lost sessions. And this has fixed all my redirect issues except when the permissions dialog shows up.

Anyone else seeing this? Any idea how to fix? Help!


回答1:


Figured it out on my own.

The OmniAuth Overview wiki page suggests the fix below in application_controller.rb to fix lost sessions:

def authenticate_user!
  if !current_user
    # This should work, but session is lost. 
    # session[:return_to] = request.fullpath
    redirect_to user_omniauth_authorize_path(:google_apps, :origin => request.fullpath)
  end
end

But instead of using request.fullpath in the snippet above, the key is to use request.env["HTTP_REFERER"] instead.



来源:https://stackoverflow.com/questions/7898203/facebook-app-using-devise-is-redirecting-away-from-fb-canvas

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!