我想编写一个应用程序来处理我的一些以某种方式标记的 Gmail 电子邮件。
这里的示例代码为我的代码提供了一个起点(我使用 Promise 而不是 async wait 重写了代码):
'use strict';
const path = require('path');
const { google } = require('googleapis');
const { authenticate } = require('@google-cloud/local-auth');
authenticate({
keyfilePath: path.join(__dirname, 'key.json'),
scopes: [
'https://www.googleapis.com/auth/gmail.readonly',
],
}).then(auth => {
google.options({ auth })
gmail.users.messages.list({
userId: "me",
}).then((res) => {
console.log(res.data)
}).catch(err => {
console.log(err)
})
}).catch(err => {
console.log(err);
})
Run Code Online (Sandbox Code Playgroud)
以下是我到目前为止所采取的步骤:
key.jsonGOOGLE_APPLICATION_CREDENTIALS="$(pwd)/key.json" node index.js
Run Code Online (Sandbox Code Playgroud)
这是我收到的错误:
TypeError: Cannot read property 'redirect_uris' of undefined
at authenticate (/home/user/dev/gmail-processor/node_modules/@google-cloud/local-auth/build/src/index.js:46:15)
at …Run Code Online (Sandbox Code Playgroud) javascript node.js google-cloud-platform gmail-api google-auth-library-nodejs
我使用lua C-API读取存储在lua文件中的配置数据.
我在文件中有一个漂亮的小表,我编写了一个查询C函数来解析表中的特定字段.(它的确有效!)
它通过一遍又一遍地调用这些函数中的一些来工作:
...
lua_getglobal (...);
lua_pushinteger (...);
lua_gettable (...);
lua_pushstring (...);
lua_gettable (...);
lua_lua_getfield (...);
...
Run Code Online (Sandbox Code Playgroud)
你明白了.
在我查询完这样的数据之后,我是否必须清理堆栈?