turbot / steampipe-plugin-googleworkspace

Use SQL to instantly query calendar events, drive files, gmail messages, and more from Google Workspace. Open source CLI. No DB required.
https://hub.steampipe.io/plugins/turbot/googleworkspace
Apache License 2.0
18 stars 3 forks source link

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

Open judell opened 2 years ago

judell commented 2 years ago

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.

Subhajit97 commented 2 years ago

@judell thanks for opening this issue. We are looking into this issue. Seems like the access token is not getting refreshed after getting expired. We have checked the SDK and seems like ReUseTokenSource is probable solution. We will provide an update on this ASAP.

github-actions[bot] commented 2 years ago

'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.'

github-actions[bot] commented 1 year ago

'This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.'

github-actions[bot] commented 1 year ago

'This issue was closed because it has been stalled for 90 days with no activity.'

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] commented 11 months ago

This issue was closed because it has been stalled for 90 days with no activity.