Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When does Refresh Token expires for Google Drive API?

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.

like image 907
mr. Prophet2 Avatar asked Oct 15 '25 19:10

mr. Prophet2


1 Answers

Refresh tokens shouldn't expire but they can.

  1. If the user removes your access though their Google account the refresh token will expire
  2. if the refresh token has not been used in six months it will expire.
  3. When you a user authenticates your application you get an access token and refresh token, if they authenticate your application again, you will get another access token and refresh token. You can have up to fifty refresh tokens for a users account and they will all work but after 50 the first one will expire.

Access tokens expire after an hour and you use the refresh token to request a new one.

Update for 2021

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.

like image 155
DaImTo Avatar answered Oct 17 '25 07:10

DaImTo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!