我的 fb 应用程序有问题。我使用本教程:http: //3adly.blogspot.com/2012/12/ruby-on-rails-facebook-application.html我在 Heroku 上托管了应用程序,如果我使用应用程序作为授权请求框,则无法正常工作iframe ( https://apps.facebook.com/my-app )。在铬控制台中,我看到错误:
Refused to display 'https://www.facebook.com/dialog/oauth?client_id=123...%2Fmy-app.herokuapp.com%2F%2F&scope=read_stream' in a frame because it set 'X-Frame-Options' to 'DENY'.
但我的 config/application.rb 中有正确的 x-auth 值:
module TestApp
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
config.action_dispatch.default_headers = {
'X-Frame-Options' => 'ALLOWALL'
}
end
end
当我独立使用我的应用程序(https://my-app.heroku.com)时,我看到带有“权限请求”的框,当我单击“确定”时,我的应用程序在 IFrame 中独立运行。我的应用程序工作正常,因为我可以看到“Hi Grzegorz”,在我看来我有 Hi <%= @user_profile["first_name"] %>!。这对我来说很奇怪,为什么我在 IFrame 中看不到带有权限请求的框?