'Oauth2 token refreshed itself, and my app no longer works. How do I fix this?

I have a simple little java app which puts data into a google sheet. It was working for a little while until I got this error:

"error": "invalid_grant", "error_description": "Token has been expired or revoked."

I tried refreshing the token/creating a new oauth2 application, but nothing worked.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source