发布带有图像的 post 在页面中不起作用

Publish post with image doesn't work in page

我得到了如下所述的页面访问令牌。当我尝试将带有图像的 post 制作到 Facebook 页面时。它使用我的用户帐户 posts 访问 Facebook 页面,而不是页面本身 post.

获取页面访问令牌

$facebook.api("/" + page_id + "?fields=access_token").then(function(response){
  auth_token = response.access_token;
});

Post 到页面

$facebook.api("/"+page_id+"/photos","POST",
{
  caption: body,
  url: "http://g-ecx.images-amazon.com/images/G/01/img15/pet-products/small-tiles/23695_pets_vertical_store_dogs_small_tile_8._CB312176604_.jpg",
}).then(function(response){
  $scope.result = response;
});

问题:它使用了我的用户帐户 post。我怎样才能让我的页面改为post?

确保您的页面令牌包含 publish_pages 权限,并在您的 API 调用中添加页面令牌:

$facebook.api('/' + page_id + '/photos', 'POST', {
    caption: body,
    url: "http://g-ecx.images-amazon.com/images/G/01/img15/pet-products/small-tiles/23695_pets_vertical_store_dogs_small_tile_8._CB312176604_.jpg",
    access_token: auth_token
}).then(function(response){
    $scope.result = response;
});

您可以在此处调试您的令牌:https://developers.facebook.com/tools/debug/accesstoken/