-1

我得到了頁面訪問令牌,如下所述。當我試圖發佈圖像到Facebook頁面的帖子時。它使用我的用戶帳戶發佈到facebook頁面,而不是頁面本身發佈。與圖像發佈帖子在頁面中不起作用

獲取頁面訪問令牌

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

帖子頁

$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; 
}); 

問題:它用我的用戶帳戶發佈。我怎樣才能讓我的網頁發佈呢?

+1

使用頁面訪問令牌 – WizKid

+0

HTTP: //www.devils-heaven.com/facebook-access-tokens/ – luschn

+0

https://developers.facebook.com/docs/facebook-login/access-tokens/ – luschn

回答

0

確保您的網頁憑證,包括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/

相關問題