0

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 ) で使用すると、「権限要求」のボックスが表示されます。[OK] をクリックすると、アプリは IFrame とスタンドアロンで動作します。「Hi Grzegorz」が表示されるため、アプリは正常に動作します。私のビューには、Hi <%= @user_profile["first_name"] %>! があります。これは私にとって奇妙です。IFrame にアクセス許可要求のボックスが表示されないのはなぜですか?

4

1 に答える 1

0

以前、同様の問題が発生したことがあります。アプリケーション構成のリダイレクト URL が、承認 URL で使用されているものとは異なる場合でした。また、http/https の使用法が一貫しているかどうかも確認してください。

さらに、認証リンクに属性 target="_top" があるかどうかを確認します。こちらを参照してください: http://www.techguywebsolutions.com/facebook-app-getloginurl-issue.html

于 2013-11-18T10:13:35.820 に答える