Expiring Gmail api access token

Viewed 42

hello i'build a Gmail api to automate checking my emails daily using api with python but the problem is the users tokens it expire all time there any way to prolong it to 6 months...

file is quickstart.py

1 Answers

Access tokens by design expire after one hour there is no way to change that, that is why you have a refresh token. Refresh tokens can be used to request a new access token when ever you need it.

A Google Cloud Platform project with an OAuth consent screen configured for an external user type and a publishing status of "Testing" is issued a refresh token expiring in 7 days.

To stop your refresh tokens from expiring set it to production.

enter image description here

Related