Manually expire token in google api

It seems I need to wait 60 minutes for the google token to expire. I am trying to check if my code is working on how to refresh the token, I have no time to wait 60 minutes to check if it works.

Is there a way to end the google token manually so I can check if my refresh token code is working?

+3


source to share


2 answers


By canceling the access_token, you also cancel the refresh_token, docs :

The token can be an access token or a refresh token. If the token is an access token and has a matching refresh token, the refresh token will also be revoked .

So there is no way to expire the access_token and save the refresh_token.



But you can check if refresh_token is working without access_token expiring (you can have many access_token).

Otherwise, you can just check the status of your access_token on this url:
https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=YOUR_TOKEN_HERE

And according to the refund, you are updating or not using the access_token.

+5


source


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

should cancel it. documentation



If you are using a PHP client firewall, you can call a function $client->revokeToken(token)

to have the client make that call for you.

-1


source







All Articles