google / gmail-oauth2-tools

Tools and sample code for authenticating to Gmail with OAuth2
Apache License 2.0
405 stars 211 forks source link

GMail refresh token retrieval no longer working #49

Closed mathstuf closed 11 months ago

mathstuf commented 2 years ago

Is this expected to work anymore? It seems that policies have changed and the urn:ietf:wg:oauth:2.0:oob URL is no longer valid. So…how is a desktop application supposed to communicate with the GMail API anymore?

mathstuf commented 2 years ago

It seems that using a REDIRECT_URI = 'https://localhost' is a workaround; the refresh token can be scraped from the address bar at least.

mmackay055 commented 2 years ago

I had a similar issue when using the oauth2.py but found it was using https://accounts.google.com/o/oauth2/token to request tokens vs using https://oauth2.googleapis.com/token as stated in google's documentation docs.

I feel there is probably other outdated urls in the script as well.

mathstuf commented 2 years ago

See the second comment here for a workaround. I'll note that I got an email about OOB-using client IDs being expired in October, so I'll need this before then at least, but I'm not sure when I'll get to it.

junyer commented 11 months ago

Fixed in commit 944cffd66df38863eb0252a8096961335e418e70.