为什么我的 Google Apps 脚本权限在几天后被撤销? [英] Why my Google Apps Script permissions are revoked after few days?

本文介绍了为什么我的 Google Apps 脚本权限在几天后被撤销?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Google Apps Script 的帮助下制作了一个在 Google 电子表格上运行的简单 Telegram 机器人.它会在工作表中进行查找,并可选择将上传的文件保存到我的 Google 云端硬盘.

I made a simple Telegram bot that runs on Google Spreadsheet with a help of Google Apps Script. It does a lookup in sheets and optionally saves an uploaded file to my Google Drive.

以前它是附加到电子表格的脚本.后来 Google 建议在 Google Cloud Console 中创建一个 App 并将脚本分配给该 App id,因此所有 API 调用都是负责任的.

Previously it was a Script attached to the Spreadsheet. Later Google suggested to create an App in Google Cloud Console and assign the script to that App id, so all API calls are accountable.

脚本应用程序未经验证并在发布状态:测试"下运行;模式.我只需要它来访问我的帐户数据.

Script app is not verified and runs in "Publishing status: Test" mode. I only need it to access my account's data.

我授予脚本的权限(访问表格、云端硬盘)会在大约 2-3 天后在没有任何通知的情况下自动撤销,并且机器人停止工作.直到我重新访问 Shpreadsheet,打开扩展 - 应用程序脚本,运行任何函数并再次请求授权.然后机器人再工作几天.

The permissions I gave to the script (access to Sheets, Drive) get automatically revoked without any notice after about 2-3 days, and the bot stops working. Until I revisit the Shpreadsheet, open Extensions - Apps Script, run any function and it asks for authorization again. Then the bot works for a couple of days more.

如何使我授予的权限永久化?

How can I make the permissions I give permanent?

我(再次)授予我的应用的权限:

Permissions I granted (again) to my app:

电子表格应用的更新菜单:

Updated menu of the Spreadsheet app:

推荐答案

来自 设置您的 OAuth 同意屏幕 >测试

测试用户的授权自同意之日起 7 天后到期.如果您的 OAuth 客户端请求离线访问类型并收到刷新令牌,该令牌也会过期.

Authorizations by a test user will expire seven days from the time of consent. If your OAuth client requests an offline access type and receives a refresh token, that token will also expire.

考虑到上述情况,您必须让 Google 验证您的应用.

Considering the above you have to get your app to be verified by Google.

这篇关于为什么我的 Google Apps 脚本权限在几天后被撤销?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆