3
votes

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.

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.

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: App settings in my Account

Updated menu of the Spreadsheet app: Google Spreadsheet menu bar

1
@Rubén, Google Cloud Console — this project settings, APIs and Services - OAuth consent screen – reads "Publishing status: Testing". "Open Extensions - Apps Scripts" is about updated Spreadsheets interface to open up the ex-Script window with the code.Serge
@Rubén there, I added the menu bar screen shot: it slightly changed recently. Previously "Script" was under Tools menu, no icon, if I am not mistaken.Serge

1 Answers

6
votes

From Setting up your OAuth consent screen > Testing

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.

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