我完成了this doc中描述的所有步骤。 但是当我执行时:
node quickstart.js
我得到回应:
{[错误:invalid_grant]代码:400}
我的代码:
fs.readFile('../../config/gmail-auth-key.json', function processClientSecrets(err, content) {
var count = 0;
if (err) {
console.log('Error loading client secret file: ' + err);
return;
}
// Authorize a client with the loaded credentials, then call the
// Gmail API.
authorize(JSON.parse(content), sendMessage);
function sendMessage(auth) {
gmail.users.messages.list({
auth: auth,
userId: 'me'
});
}
});
我之前使用过Gmail API,系统中可能还生成了一些令牌文件?