1

我已经尝试了很长时间才能使其正常工作,但没有成功。在我的 oauth.yml 文件中,app_id 和 secret_id 与我的 Facebook 应用设置相匹配。我已经重新启动了我的服务器,以防出现未解决的配置问题。可能是什么问题呢?

我不断得到:

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

这是我的 Facebook 应用设置的屏幕截图: 在此处输入图像描述

我的 fb.init.html.erb 文件如下所示:

<div id="fb-root"></div>
<script>
  window.fbAsyncInit = function() {
    // console.log("fbinit file");
    FB.init({
      appId      : '<%= OAUTH_CONFIG['facebook']['app_id'] %>',
      status     : true,
      cookie     : true,
      xfbml      : true,
      oauth      : true
    });
  };
  (function(d){
    // console.log("fbinit file2");
    var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
    js = d.createElement('script'); js.id = id; js.async = true;
    js.src = "//connect.facebook.net/en_US/all.js";
    d.getElementsByTagName('head')[0].appendChild(js);
  }(document));
</script>

谢谢你的帮助。

4

2 回答 2

2

因此,看起来您在屏幕截图中提供的应用 ID 与实际传递给 Facebook 的应用 ID 不同。

在屏幕截图中,它以144574...您的请求开头

https://www.facebook.com/dialog/oauth?display=popup&domain=populisto.com&scope=email&e2e=%7B%7D&app_id=378201315578308&locale=en_US&sdk=joey&client_id=378201315578308&redirect_uri=http%3A%2F%2Fstatic.ak.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D25%23cb%3Df1f01bac64%26origin%3Dhttp%253A%252F%252Fpopulisto.com%252Ff27e5c37e8%26domain%3Dpopulisto.com%26relation%3Dopener%26frame%3Df25e63bce&origin=1&response_type=token%2Csigned_request

所以 app_id 是378201315578308

于 2013-07-18T10:44:15.967 回答
0

在我的 oauth.yml 中,我有:

development:
  facebook:  
    app_id: "3032327...etc"
    app_secret: "ebe99065439676ed...etc"
    options:
      scope: "email"
      display: "page"

staging: &staging
  facebook:
    app_id: "3782013...etc"
    app_secret: "4dabe290bd8ad7f815c54ad...etc"
    options:
      scope: "email"
      display: "page"

test:
  <<: *staging

production:
  facebook:
    app_id: "144574445...etc"
    app_secret: "501bf4e3202cd8578e322...etc"

所以我把所有的环境都改成这样:

development:
  facebook:
    app_id: "14457444574...etc"
    app_secret: "501bf4e3202cd8578e322...etc"
    options:
      scope: "email"
      display: "page"

staging: &staging
  facebook:
    app_id: "1445744457...etc"
    app_secret: "501bf4e3202cd8578e3223...etc"
    options:
      scope: "email"
      display: "page"

test:
  <<: *staging

production:
  facebook:
    app_id: "1445744457...etc"
    app_secret: "501bf4e3202cd8578e3223...etc"

现在它可以工作了。为什么它使用我的“暂存”设置?我在哪里可以将其更改为“生产”?

于 2013-07-19T09:00:37.260 回答