繁体   English   中英

是否可以将您是管理员的页面发布到使用Facebook Javascript SDK的页面上?

[英]Is it possible to post to pages that you are an admin for using the Facebook Javascript SDK?

我可以在自己的墙上写字,但不能在我作为管理员的页面墙上写字。 我正在使用下面的代码(JavaScript SDK):

         FB.ui(
           {
             method: 'stream.publish',
             message: 'getting educated about Facebook Connect',
             attachment: {
               name: 'Connect',
               caption: 'The Facebook Connect JavaScript SDK',
               description: (
                 'A small JavaScript library that allows you to harness ' +
                 'the power of Facebook, bringing the user\'s identity, ' +
                 'social graph and distribution power to your site.'
               ),
               href: 'http://github.com/facebook/connect-js'
             },
             action_links: [
               { text: 'Code', href: 'http://github.com/facebook/connect-js' }
             ],
             user_message_prompt: 'Share your thoughts about Connect',
             target_id: '170500829645508',
             uid: '100001920038281'
           },
           function(response) {
             if (response && response.post_id) {
               alert('Post was published.');
             } else {
               alert('Post was not published.');
             }
           }
         );
         }

目标ID是我管理的页面,而uid是我的帐户用户ID。 当我运行此代码时,我不断收到错误消息:

指定了无效的目标:170500829645508。目标必须是参与者可以在其墙上张贴的页面,事件或用户。

我在这里做错什么了吗?

您需要manage_pages扩展权限才能执行此操作。 授予权限后,您可以查询graph.facebook.com/me/accounts来检索可以发布到页面墙的API令牌。 在此处查看Facebook的扩展权限: http : //developers.facebook.com/docs/authentication/permissions

我最终使用了这种方法,该方法适用于发布到我管理的页面。 虽然还没有弄清楚如何以这种方式包括附件...

     var wallPost = {
        access_token: ".........................",
        message: 'Here is some more stuff'
    };

    FB.api('/me/feed', 'post', wallPost, function(response) {
        if (!response || response.error) {
            alert('Error occurred:' +  response.error.message);
        } else {
            alert('Success!');
        }
    });

暂无
暂无

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

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