0

My app, made in ruby on rails, uses omniauth and omniauth-facebook gems. It consists of a 'Log In with Facebook' button. It works fine in localhost - people can log in with Facebook - but I can't get it working on my live server. As far as I can see I've changed the relevant details, but is there something I'm missing?

As I said, it works fine in localhost:3000. I've changed these details to try get it working at www.example.com, but I keep getting the error message:

Given URL is not permitted by the application configuration.: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.

In my config/oauth.yml file I have:

development:
  facebook:
    app_id: "12345"
    app_secret: "abcde"
    options:
      scope: "email"
      display: "page"

staging: &staging
  facebook:
    app_id: "12345"
    app_secret: "abcde"
    options:
      scope: "email"
      display: "page"

test:
  <<: *staging

production:
  facebook:
    app_id: "12345678"
    app_secret: "abcdefgh"

I've changed the app_id and app_secret in 'production' to match my the id and secret of my application, which I made in Facebook.

In environments/production.rb I've put:

  # Need this here for mailing purposes
  config.action_mailer.default_url_options = { :host => 'www.example.com' }

In environments/development.rb I've put:

  # Don't care if the mailer can't send
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.default_url_options = { :host => 'www.example.com' }

Am I overlooking something? Maybe there's something I need to change in my Facebook Apps section, where it gave me the id and secret? Any help would be appreciated.

4

2 回答 2

0

在具有 Facebook 登录站点 url 的网站上应设置为您网站的 URL 并在应用程序域上设置为您的主机,例如:

应用领域::example.com

网站网址:http://example.com/

environments/production.rb你应该放:

  config.action_mailer.default_url_options = { :host => 'example.com' }
于 2013-07-11T08:24:50.520 回答
0

当我正确完成所有设置时,同样的事情发生在我身上。结果发现,在我的 Facebook 仪表板上,App ID 和 App Secret 不知何故发生了变化。您可能在仪表板上进行了更改,以某种方式更改了 ID 和 Secret。再次确认这些详细信息

于 2014-12-02T11:45:46.530 回答