I am trying to automate an internal process when i receive a gmail messages, and attach to a nodejs backend process. So far the script works ok, when the token is newly generated. I am aware that i have periodically renew watch end point at least once per day.. as written here : https://developers.google.com/gmail/api/guides/push#renewing_mailbox_watch
However even after I done this, I come to another stumbling block. Sometimes after several days, suddenly my script broke with error message "Token expired / revoked". There's been a lot of discussion here : 'Token has been expired or revoked' - Google OAuth2 Refresh token gets expired in a few days but nothing really worked. I still end up going back and forth communicating with google team, and they still say that since its personal use, they advise the app still work as unverified, and that the issue isnt related with OAUTH or the app getting verified.
My question: is there a way to automate renewing the token with the following condition:
- the app still uses testing / unverified status
- i dont have to add manual work, ie: to dismiss context menu next to notification
- preferably by calling a curl end point, so i can automate the process.
I tried contacting google team via email. I am expecting them to verify my app, or at least provide some direction how to automate a testing app so the token wont get revoked everytime.
Thank you in advance