googleworkspace / apps-script-oauth2

An OAuth2 library for Google Apps Script.
https://developers.google.com/apps-script/
Apache License 2.0
1.56k stars 429 forks source link

Refresh doesn't work #423

Open delerino opened 1 year ago

delerino commented 1 year ago

My OAuth service is never refreshing (even manually), and the service is never recognizing my token as 'expired' also.

I noticed that the service was trying to access the 'refreshUrl_' when that variable was never setted up (=null).

So, I solved setting the refreshUrl_ to same as tokenUrl (.setRefreshUrl()) and manually refreshing (service.refresh()) when my API returned unauthorized.

I hope it may helps someone.

Mahesh-zeit commented 1 year ago

if you can tell me how to do that with the code, thank you