Skip to content

tokens should be cleaned out by gradle at will #635

Open
@max8github

Description

@max8github

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions