Rails Facebook iframe 应用程序在用户授权后被重定向到画布之外
这个问题是在 Facebook iframe 的另一篇文章中提出的应用程序在用户授权后被重定向出画布,但是,我遇到了同样的问题,并且不明白如何实现帖子中描述的修复。如果他们发布固定控制器,那就太棒了。这是我的控制器。
class AppController < ApplicationController
def index
@oauth = Koala::Facebook::OAuth.new("APP_ID", "APP_SECRET", "https://quiet-mist-8418.heroku.com/app/redirect" )
if (session[:access_token].blank?)
redirect_to @oauth.url_for_oauth_code and return
end
@graph = Koala::Facebook::API.new(session[:access_token])
@friends = @graph.get_connections("me", "friends").to_s
end
def redirect
@oauth = Koala::Facebook::OAuth.new("APP_ID", "APP_SECRET", "https://quiet-mist-8418.heroku.com/app/redirect" )
session[:access_token] = @oauth.get_access_token(params[:code]) if params[:code]
redirect_to(:action=>"index")
end
end
This question was asked in another post at Facebook iframe app being redirected out of canvas after user authorization, however, I'm having the same problem and don't understand how to implement the fix described in the post. If they posted the fixed controller, it would be awesome. Here's my controller.
class AppController < ApplicationController
def index
@oauth = Koala::Facebook::OAuth.new("APP_ID", "APP_SECRET", "https://quiet-mist-8418.heroku.com/app/redirect" )
if (session[:access_token].blank?)
redirect_to @oauth.url_for_oauth_code and return
end
@graph = Koala::Facebook::API.new(session[:access_token])
@friends = @graph.get_connections("me", "friends").to_s
end
def redirect
@oauth = Koala::Facebook::OAuth.new("APP_ID", "APP_SECRET", "https://quiet-mist-8418.heroku.com/app/redirect" )
session[:access_token] = @oauth.get_access_token(params[:code]) if params[:code]
redirect_to(:action=>"index")
end
end
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有趣的是,我进入了 Facebook 开发者应用程序的设置页面,并对设置进行了一些更改 > auth 对话部分,它似乎按预期工作。我检查了标记为“身份验证推荐”的部分。现在授权后就停留在页面上。
Interestingly, I went to the settings page of my the Facebook developer app, and made some changes to the settings > auth dialogue section, and it seems to be working as desired. I checked the section marked, "authentication referrals." Now, it stays on the page after authorizing.