Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tokens should be cleaned out by gradle at will #635

Open
max8github opened this issue May 31, 2023 · 1 comment
Open

tokens should be cleaned out by gradle at will #635

max8github opened this issue May 31, 2023 · 1 comment
Assignees

Comments

@max8github
Copy link

max8github commented May 31, 2023

Summary

StoredCredential file is not cleaned out by gradle

Sample Name

Google Calendar Quickstart

Expected Behavior

There should be a clean gradle command that really does clean, given that in the example a tokens/StoredCredential file gets created when you first run the example.

Actual Behavior

The user is unaware of the fact that a tokens/StoredCredential file gets dumped when running the calendar/quickstart example the first time. The user takes care of the credentials.json file as per instructions on this page.
If after a while, the credentials expire (like in test mode, after 7 days, say) and the user then tries to rerun the example, even with a new, valid regenerated credentials.json the sample code will fail, leaving the user a bit puzzled. The user gets an error like:

> Task :run FAILED
Exception in thread "main" com.google.api.client.auth.oauth2.TokenResponseException: 400 Bad Request
POST https://oauth2.googleapis.com/token
{
  "error": "invalid_grant",
  "error_description": "Token has been expired or revoked."
}

with little indication of why, because after getting new credentials, calls will still fail.
Adding a Gradle command like for example gradle cleanStoredCredential and a good .gitignore file may help.

Specifications

  • Java version (java -version) as specified in gradle
  • OS (Mac/Linux/Windows) any
@max8github
Copy link
Author

Attaching a possible diff to use, as I am unsure at this point on how to create a pull request.
This diff is created from directory java-samples/calendar/quickstart.
diff.diff.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants