【问题标题】:Facebook App using Devise is redirecting away from FB Canvas使用 Devise 的 Facebook 应用程序正在从 FB Canvas 重定向
【发布时间】:2011-10-26 02:45:51
【问题描述】:

当用户第一次安装我的 facebook 应用程序时,会显示一个 facebook 徽标,请求权限,然后将用户从 iframe 中弹出。

我最近(10 月 14 日)应用了添加到设计网站上的 OmniAuth Overview wiki page 的关于 lost sessions 的说明。这解决了我所有的重定向问题,除了权限对话框出现时。

还有人看到这个吗?知道如何解决吗?救命!

【问题讨论】:

    标签: facebook devise omniauth


    【解决方案1】:

    我自己想出来的。

    OmniAuth Overview wiki 页面建议在 application_controller.rb 中进行以下修复以修复丢失的会话:

    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
    

    但是上面的sn-p中不要使用request.fullpath,关键是要使用request.env["HTTP_REFERER"]

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-06-07
      • 2011-05-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-27
      相关资源
      最近更新 更多