Search code examples
google-oauthgoogle-authentication

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


I am a fair way through implementing an actionscript OAuth library which I am initially testing with Google's Drive Api.

I know how you are supposed to refresh an access token using your refresh token but my question is how do I test it?

How do I make my access_token expire so that I test my code that catches the error, attempts a refresh and then re-loads the initial request? If I can only do this once a week (or however often they expire) it's going to take a while to get it right!

Thanks


Solution

  • 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.