2012-12-03 18 views
3

使用Node.js發佈Open Graph操作facebook-node-sdk模塊給我{"error": "An active access token must be used to query information about the current user."}Facebook訪問令牌不被用於使用Node.js打開圖表facebook-node-sdk

var FB = require('fb') 
var path = '/me?' + namespace + ':' + action_type_name 
var body = { 
    access_token: myAccessToken, 
    myAction : myCustomObjectURL 
} 
FB.api(path, 'post', body, function(res) 
{ 
    if(res.error) { 
     console.log('the call to open graph failed: ' + res.error.message); 
    } 
    else { 
     console.log('success') 
    } 
}) 

如果我打印此訪問令牌,並與捲曲(curl https://graph.facebook.com/me?access_token=myAccessToken)使用它,它會返回正常,沒有錯誤。 Facebook還顯示該應用程序有權以此用戶身份發帖。那麼我在這裏做錯了什麼?

回答

0

德哦,愚蠢的問題。事實證明,我需要一個斜槓,而不是URL路徑中的問號:path = '/me/' + ...

相關問題