我有一个 node.js 程序,我正在尝试使用 googleapis 模块(https://github.com/google/google-api-nodejs-client)版本 0.2.5-alpha。
我可以毫无问题地使用原始 HTTP 进行调用,因此我知道我在 API 的白名单中,我正在正确地进行身份验证和授权,并且正在请求正确的范围和所有内容。如果我使用相同的 access_token 插入时间线,我会在回调中收到错误。我还发现了 plus API,并且使用此 API 的调用工作正常。
用于发现 API 的代码片段,似乎可以正常工作:
var client;
googleapis
.discover( 'plus', 'v1' )
.discover( 'mirror', 'v1' )
.execute( function(err,data){
console.log( err );
client = data;
});
进行调用的代码片段:
client.mirror.timeline.insert({
文本:“测试 1”
} ).withAuthClient(user.auth).execute(function(err,result,res){
console.log('++ 开始 ++');
console.log('+err', err);
console.log('+结果', 结果);
//console.log('+res', res);
console.log('++ end ++');
});
回调期间记录的内容:
++开始++
+错误{代码:400,
消息:'必需',
数据:[{域:'全局',原因:'必需',消息:'必需'}]}
+结果未定义
++结束++
任何指示什么是“必需的”,如何提供它,或者如何进一步调试诸如此类的错误?