How do I test refreshing my google access token using a refresh token

Well, judging by the lack of responses to this question I am assuming that there is no way to do this.

This page: https://developers.google.com/youtube/v3/guides/authentication#installed-apps

describes how to revoke an access or refresh token by using this url:

https://accounts.google.com/o/oauth2/revoke?token={token}

but then says:

The specified token can be an access token or a refresh token. If the token is an access token and it has a corresponding refresh token, the refresh token is also revoked.

So if you just want to revoke an access token you aren't able to.

I think the only solution is to wait for the access token to expire (seems to take an hour) then go about testing your app.

I'll be very happy if anyone tells me a faster way to make the token expire.


If you're looking to test your code, you don't actually need to invalidate or expire the access token. Simply make a (say) Drive call with a null access token and you will receive the same 401 response that you would have got with an expired access token.


I handle this testing by simply making note of an expired access_token. Then when I need to test how my app deals with an expired token I simply give the app that expired token to work with. This way, for example, I can test that requests with an expired token will fail as expected.


The easiest way of doing it is using the OAuth Playground 2.0

https://developers.google.com/oauthplayground/

In step 2 especially, you can try refreshing your access token with a refresh token.

Additionally, in the setting (the gear icon), you can set up your own OAuth Credentials to test it out for your own API project.