我最近開始涉足Facebook Graph api。我已經使用命名空間'Test'定義了一個自定義操作'Start',這裏是我用來發布到Facebook的代碼。Facebook圖形API,FB.api發佈自定義操作後第一次失敗,但第二次成功
FB.api('/me/Test:start',{ article : currentURL, message: $j('.subject-content h2 a').html()}, 'post', function(response) {
if (!response || response.error) {
console.log('Error '+response.error.message);
}
else {
console.log('Message was posted! (post id: ' + response.id + ")");
}
});
由於某些原因,此帖子第一次失敗,但在隨後的嘗試中,帖子成功。
這裏是我從螢火蟲捕獲的要求。
1)
access_token xxxxx
article https://testserver:8080/xxx
callback FB._callbacks.__gcb2
message testpage
method post
pretty 0
sdk joey
2)
access_token yyyy
article https://testserver:8080/xxx
callback FB._callbacks.__gcb6
message testpage
method post
pretty 0
sdk joey
正如你可以看到通話是完全一樣的。我第一次得到這個迴應
/**/ FB._callbacks.__gcb4({"error":{"message":"An unknown error has occurred.","type":"OAuthException","code":1}});
我在圖表瀏覽器上也嘗試過相同的請求,它每次都有效。
我做錯了什麼?任何幫助都會很棒。
在此先感謝。
感謝您的回覆,我沒有使用本地主機。我正在測試這個公共領域。我只是用虛擬網址替換了測試環境網址 – Shashi