facebook OpenGraph API on Rails (FBGraph)

发布于 2024-09-15 04:10:12 字数 331 浏览 7 评论 0原文

我正在尝试使用 FBGraph 让我的应用程序在用户墙上发布消息。然而,所有 API 对我来说都有点陌生,我只是试图改变一些事情,看看会发生什么。现在,我收到此错误消息

{
   "error": {
      "type": "OAuthException",
      "message": "Invalid redirect_uri: Given URL is not allowed by the Application configuration."
   }
}

有人知道redirect_uri是什么意思吗?我的 Facebook 应用程序设置页面上会显示什么?

I am trying to use FBGraph to let my app publish messages on the users wall. However, all of the APIs are kind of foreign to me and I am just trying to change things and see what happens. Right now, I am getting this error message

{
   "error": {
      "type": "OAuthException",
      "message": "Invalid redirect_uri: Given URL is not allowed by the Application configuration."
   }
}

Does anyone know what it means by redirect_uri? What would it be on my Application Settings page on facebook?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

我的黑色迷你裙 2024-09-22 04:10:12

弗罗林是正确的。这里请注意..在本地测试时,您需要将其设置为:

http://localhost:3000/ (或无论您的应用程序服务器端口是什么)

然后,当您将其移至生产环境时,将其设置为常规 URL:

http://yourdomain.com /

我有一个单独的 Facebook 应用程序,我在开发中使用它来进行测试,因此我不必在它们之间来回更改,并且我在设置文件中设置了密钥,其中包含用于开发的令牌和生产应用程序。

不管怎样,看起来你已经快到了。它至少返回到回调 URL。更新 facebook_connect URL 后应该没问题

Florin is correct. Just a note here.. when testing locally you will need to set it to:

http://localhost:3000/ (or whatever your app server port is)

Then when you move it to production, set it to your regular URL:

http://yourdomain.com/

I have a separate facebook app that I use in development to test, so I don't have to change back and forth between them and I set up the keys in a settings file, which has my tokens for development and production apps.

Anyways, looks like you are almost there. It is making it back to the callback url at least. Should be fine once you update the facebook_connect URL

妄想挽回 2024-09-22 04:10:12

我不是 Facebook 专家,但几个小时前,当我尝试使用 Facebook 登录 Web 应用程序内的用户时,我遇到了与您完全相同的问题。

看来您在调用“https://graph.facebook.com/oauth/ 时指定的redirect_uri授权”必须与应用程序的连接 URL 位于同一域中。 (您可以从应用程序设置中的“连接”部分设置该连接 URL)

此致,
弗罗林

I am not a facebook expert, but I hit the exact same problem as you a few hours ago when I was trying to login a user inside a web application with Facebook.

It seems that the redirect_uri which you specify in your call to "https://graph.facebook.com/oauth/authorize" must be on the same domain as the Connect Url of your application. (you can set that connect url from the Connect section in your application's settings)

Regards,
Florin

国际总奸 2024-09-22 04:10:12

可能需要检查您的设置>基本>基本信息>应用程序域。我相信也需要为redirect_uri 设置正确的帽子。

May need to check your Settings > Basic > Basic Info > App Domain. I believe hat needs to be set correctly for the redirect_uri as well.

满身野味 2024-09-22 04:10:12

我有同样的问题。

就我而言,我在 facebook 上配置了站点 url 为:“http://localhost:3000”,这是 facebook 的错误 URL。

原因是 url 末尾缺少 /,所以正确的站点 url 应该是:
“http://localhost:3000/”

I had the same issue.

In my case, I had configured site url on facebook as: "http://localhost:3000", it was a wrong URL to facebook.

The reason is, it lack of the / in the end of url, so the correct site url should be:
"http://localhost:3000/"

尐偏执 2024-09-22 04:10:12

只需验证您的“应用程序 ID”即可。就我而言,我遇到了这个问题,因为我正在使用我正在从事的其他项目的 ID。相当明显,但我损失了一些时间。

Just verify your 'Application ID'. In my case I had that problem because I was using ID from my other project that I was working on. Fairly obvious but I lost some time.

离线来电— 2024-09-22 04:10:12

我必须确保我也有范围:

config.omniauth :facebook, 'xxxx', 'xxx', :scope => 'offline_access,email,publish_stream'

另外,您确实需要确保等待几分钟,因为传播确实需要时间..

I had to make sure I had the scope in there too:

config.omniauth :facebook, 'xxxx', 'xxx', :scope => 'offline_access,email,publish_stream'

Plus you really need to make sure you wait a couple of minutes because it does take time to propagate..

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文