如何解决尝试实现NodeJS Gmail API示例
我正在尝试使NodeJs Gmail API快速入门示例正常运行。最初,我能够使示例运行并收到看起来像这样的输出。
INBOX
SPAM
ETC ...
之后我进行了一些更改,以便可以看到消息等。一旦发生这种情况,我在提示后就开始收到以下错误消息(它在先运行)。
Authorize this app by visiting this url: https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgmail.modify&response_type=code&client_id=***&redirect_uri=***
Enter the code from that page here:
我收到此错误代码
Error retrieving access token GaxiosError: invalid_grant
at Gaxios.<anonymous> (C:\***\node_modules\gaxios\build\src\gaxios.js:73:27)
at Generator.next (<anonymous>)
at fulfilled (C:\***\node_modules\gaxios\build\src\gaxios.js:16:58)
at processTicksAndRejections (internal/process/task_queues.js:97:5) {
response: {
config: {
method: 'POST',url: 'https://oauth2.googleapis.com/token',data: 'code=***client_id=***&client_secret=***&redirect_uri=http***=authorization_code&code_verifier=',headers: [Object],params: [Object: null prototype] {},paramsSerializer: [Function: paramsSerializer],body: 'code=***&client_id=***&client_secret=***&redirect_uri=***&grant_type=authorization_code&code_verifier=',validateStatus: [Function: validateStatus],responseType: 'json'
},data: {
error: 'invalid_grant',error_description: 'Malformed auth code.'
},headers: {
***,***
},status: 400,statusText: 'Bad Request'
},config: {
method: 'POST',data: 'code=***&client_id=***&client_secret=***&redirect_uri=***=authorization_code&code_verifier=',headers: {
'Content-Type': 'application/x-www-form-urlencoded','User-Agent': 'google-api-nodejs-client/3.1.2',},responseType: 'json'
},code: '400'
}
因此,我将更改恢复为原始的快速入门代码,但仍然遇到上述错误。我不知道为什么会这样,不胜感激!
解决方法
ssh -i $SSH_KEY_FILE $SSH_USER@$SERVICE_HOST "/bin/bash" << EOF
export WORKSPACE=~/my_workspace
./script_that_uses_workspace_variable.sh
EOF
的使用权在您使用后很快就会过期
尝试删除Gmail api
,然后重新启动脚本。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。