简体   繁体   English

Facebook Open Graph对象发布到时间轴

[英]Facebook Open Graph Object Post to Timeline

I've followed this tutorial: https://developers.facebook.com/docs/opengraph/tutorial/ multiple times and always get the same result. 我遵循了本教程: https : //developers.facebook.com/docs/opengraph/tutorial/多次,并且总是得到相同的结果。

I always get this error: (#15) This method must be called with an app access_token. 我总是收到此错误:(#15)必须使用应用程序access_token调用此方法。 I tried adding the app access_token and I got another error that was saying something like that I can only query for information and not make posts. 我尝试添加应用程序access_token,但出现另一个错误,该错误是我只能查询信息而不能发帖。 (I checked in the privacy settings and the app is allowed to post to timeline.) I did make the objects and found nothing wrong when using the facebook debug tool. (我检查了隐私设置,并允许该应用发布到时间轴。)我确实制作了对象,使用Facebook调试工具时没有发现任何错误。

I also read this part: 我也阅读了这一部分:

Why am I getting "This method must be called with an app access_token" error when publishing an action? 发布动作时为什么会出现“此方法必须通过应用程序access_token调用”错误?

  • Uncheck the "Require app access token to write" checkbox on the configuration page (hidden under the Advanced section) for your Open Graph action type in the Developer App. 在开发人员应用程序中,针对您的“打开图”操作类型,取消选中配置页上的“要求应用程序访问令牌才能写入”复选框(隐藏在“高级”部分下)。

I couldn't find this in app config and I have a feeling that this is old. 我在应用程序配置中找不到此文件,而且我感觉这很旧。 The code I'm using to make the post is exactly the same as the tutorial: 我用来发布帖子的代码与本教程完全相同:

  function postCook()
  {
      FB.api(
        '/me/[YOUR_APP_NAMESPACE]:cook?recipe=http://fbwerks.com:8000/zhen/cookie.html',
        'post',
        function(response) {
           if (!response || response.error) {
              alert('Error occured');
           } else {
              alert('Cook was successful! Action ID: ' + response.id);
           }
        });
  }

[I did make the appropriate changes of course :)] Any help would be greatly appreciated. [我的确做了适当的更改:)]任何帮助将不胜感激。

I think the me here assumes that you are already authenticated. 我认为这里的我假设您已经通过身份验证。 If you are not, you will have to substitute the me with the the fb id of whoever user's timeline you are posting to. 如果不是,则必须用要发布到的用户时间轴的fb ID代替我。 That user has to be authenticated in your app. 该用户必须在您的应用中通过身份验证。 and you have to use the app's access token. 并且您必须使用应用程序的访问令牌。 So the curl url would look like: 因此,curl网址如下所示:

curl -d "access_token=<app_access_token>" -d "badge=<object_url.(this has to be publicly accessible)>" https://graph.facebook.com/<authenticated_user_fb_id>/<app_namespace>:<action>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM