Facebook图形实时更新,验证本地的callback_url

时间:2011-12-29 09:07:53

标签: facebook-graph-api

在我的开发环境中(当然是localhost)。 基于此documentation,我已经成功创建了一个应用程序令牌:

https://graph.facebook.com/oauth/access_token?client_id=<app-id>&client_secret=<app-secret>&grant_type=client_credentials

然后发出post请求以验证我的callback_url到FB图,就像这样

https://graph.facebook.com/<app-id>/subscriptions?access_token=my_apps_access_token=user&fields=first_name&callback_url=http://localhost:3000&verify_token=mystringtoken

但它总是回归:

 {"error":{"message":"(#2200) callback verification failed: ","type":"OAuthException"}}

(我尝试使用lvh.me:3000)

是否可以使用localhost验证callback_url?

2 个答案:

答案 0 :(得分:1)

来自API文档:

Your callback server must handle two types of requests.

Facebook servers will make a single HTTP GET to your callback URL when you try to add or modify a subscription. After a successful subscription, Facebook servers will notify your server of changes by issuing HTTP POST requests to the same URL.

从此声明中,我认为您必须提供可公开访问的网址。

答案 1 :(得分:0)

这是How to。 &#39; ave解释这个过程。