Google Refresh Tokens Lifetime

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Google Refresh Tokens Lifetime



I've been searching around but have been seeing many conflicting answers. Is it correct that refresh tokens from Google never expire based off of time? Basically I am writing a service that'll poll my own account and so I wont run into the errors of



The user revoking access to the service (Since I'm the user)



The token hasn't been used for six months (I'm going to be polling and calling the Gmail API everyday)



The user account has exceeded a certain number of token requests. There is currently a 25-token limit per Google user account. (I'm not sure what this means but I think I'll only have 1 token active if someone could explain this)




1 Answer
1



You are right, refresh tokens never expire based off of time. Points 1 and 2 are correct, if you don't revoke access to the application and you use it daily, you wont run into those problems.



About the third one, the limit has changed to 50 refresh tokens per user and it means you cannot have more than 50 active refresh tokens for a user. You can generate new ones, but the oldest refresh tokens will get revoked. Keep this in mind in case you generate new refresh tokens.



There is also another scenario where the refresh token could be revoked, if you change your password. You will need to handle this problem and update your refresh token.



You can find more information on this link: https://developers.google.com/identity/protocols/OAuth2#expiration





I'm confused what it means to generate new refresh tokens vs refreshing new access tokens? In what scenario would we generate a new refresh token?
– developer
Aug 8 at 18:05





There could be some scenarios where you will need more than 1 refresh token stored. Imagine if you have different services in the same application and those services have different scopes, you could have different refresh tokens for each service to generate access tokens with the scopes that you need. Another scenario could be if you include new scopes in your application, users will need to accept permissions again and this will generate a new refresh token with all scopes requested. In the last case, you will need to delete the old refresh token and use the new one.
– Rubén López
Aug 9 at 7:50







By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

make 2 or more post in bootsrap

Store custom data using WC_Cart add_to_cart() method in Woocommerce 3

Firebase Auth - with Email and Password - Check user already registered