steampipe-plugin-googleworkspace icon indicating copy to clipboard operation
steampipe-plugin-googleworkspace copied to clipboard

can we use the refresh token in ./config/gcloud/application_default_credentials.json?

Open judell opened this issue 2 years ago • 6 comments

I am using method 2 from https://hub.steampipe.io/plugins/turbot/googleworkspace. I acquire the credentials file like so:

gcloud auth application-default login --client-id-file=client_secret.json --scopes="https://www.googleapis.com/auth/calendar.readonly,https://www.googleapis.com/auth/contacts.other.readonly,https://www.googleapis.com/auth/contacts.readonly,https://www.googleapis.com/auth/directory.readonly,https://www.googleapis.com/auth/drive.readonly,https://www.googleapis.com/auth/gmail.readonly,https://www.googleapis.com/auth/spreadsheets.readonly"

After a couple of days this happens:

googleapi: Error 401: Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential.

I can, and do, reacquire the credentials file. But there's a refresh token in it, shouldn't the underlying Go SDK use that to refresh the access token?

per @cbruno10:

here’s a possibly relevant discussion from the SDK repo - https://github.com/googleapis/google-api-go-client/issues/111

If that works it will also benefit the Google Directory and Google Sheets plugins.

judell avatar Apr 01 '22 16:04 judell