Reputation: 41
I just Started using Google Drive API using python to download File. I'm seeing it requires authentication for the first time and generates a token.pickle file. From next time onwards we can use this token file for API call.
Note : The file token.pickle stores the user's access and refresh tokens.
What I needed to know is when this token file will expire ? If it expires then how to extend it's validity ?
I've gone through many google documentations but couldn't find anything clear regarding this.
If anyone can suggest me any info on this, that will be most welcomed.
Upvotes: 4
Views: 6944
Reputation: 116868
Refresh tokens shouldn't expire but they can.
Access tokens expire after an hour and you use the refresh token to request a new one.
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.
Upvotes: 4
Reputation: 321
If your app's publishing status is in 'Testing', then the token will last for 2 weeks only.
If its publishing status is 'in Production' then the token has no expiry. However if any sensitive scopes are there and not verified in your app, then the number of users also limited.
These are all tested but seems no official documentation is available yet.
Upvotes: 0