Reputation: 43
I am Google Apps administrator and using xoauth.py and IMAP to download users mails without users password. But this process gets stopped after 1 hour. I searched many blogs and I came to know this token expires after 1 hour. Can anyone tell me how to extend that expiration time to Never, or how to refresh this token?
Upvotes: 1
Views: 454
Reputation: 43
try: .. catch:.. logic can be used to handle such exceptions.
As Google has retired OAuth1.0, its recommended to use OAuth2.0 instead of OAUth1.
Upvotes: 0
Reputation: 13528
I assume you're using a Service Account, OAuth 2.0 and impersonation here? See:
https://developers.google.com/accounts/docs/OAuth2ServiceAccount#expiration
there's no way to refresh the token or increase the expiration time. Your application should cache the given token to be used with all IMAP connections for one hour. After that it should generate another JWT, sign it, and request another access token.
Upvotes: 1