我正在嘗試使用facebook api連接以獲取某個頁面的提要。從圖api中獲取數據與節點
但我發現了一個訪問令牌錯誤
{"error":{"message":"Invalid OAuth access token.","type":"OAuthException","code":190,"fbtrace_id":"DrEySZsEOOA"}}
我想這樣的: Facebook.js:
var https = require('https');
exports.get = function(accessToken, apiPath, callback) {
var options = {
host: 'graph.facebook.com',
port: 443,
path: apiPath + '?access_token=' + accessToken,
method: 'GET'
};
var buffer = '';
var request = https.get(options, function(result){
result.setEncoding('utf8');
result.on('data', function(chunk){
buffer += chunk;
});
result.on('end', function(){
callback(buffer);
});
});
request.on('error', function(e){
console.log('error from facebook.get(): '
+ e.message);
});
request.end();
}
app.js:
var facebook = require('./facebook');
var http = require('http');
var server = http.createServer(app);
facebook.get('121212', '/feed/', function(data){
console.log(data);
});
server.listen(9999);
是,我通過了正確的標記。我只是修改它顯而易見的原因hahaha
會有人有一個想法或例子嗎?
謝謝大家
您是否正確設置了身份驗證https://developers.facebook.com/docs/facebook-login? –
謝謝, 我會盡力回覆新聞。對不起,延遲 –