GoogleCloudPlatform / GoogleCloudPlatform/gsutil
`gsutil` assumes the `gcloud` oauth client is always the same
- Dominant language
- Python
- Stars
- 918
- Forks
- 335
- PR merge metrics
- No merged PRs in 30d
Description
https://github.com/GoogleCloudPlatform/gsutil/blob/a077684c9afada64723b54ed100651afef015e77/gslib/utils/system_util.py#L185-L189
`gcloud` has a couple of hidden properties (but easy to find inspecting the source code) to modify the client ID and secret.
You can try by running the following commands:
```
gcloud config set auth/client_id
gcloud config set auth/client_secret
```
This works for all commands when using `gcloud`.
However, `gsutil` insists in using the same client ID and secret even when `gcloud` has `core/pass_credentials_to_gsutil` set to `True` (the default).
`gsutil` should check if `gcloud` has the properties `auth/client_id` and `auth/client_secret` set, and use those values in case they are set. If those properties are unset, then `gsutil` should use the default values (as it's doing at the moment).
Checking the values in `~/.config/gcloud/legacy_credentials/example@example.com/.boto`, the refresh token (`gs_oauth2_refresh_token`) is the one obtained with the client ID on `gcloud` with the custom properties, but the client ID and the client secret in that file are the default ones.
This makes authentication calls fail when using `gsutil`, since it tries to call:
```
POST /token HTTP/1.1
Host: oauth2.googleapis.com
content-type: application/x-www-form-urlencoded
client_secret=ZmssLNjJy2998hD4CTg2ejr2&
grant_type=refresh_token&
refresh_token={the refresh token from gcloud}&
client_id=32555940559.apps.googleusercontent.com
```
Contributor guide
Assessment
This issue has not been assessed yet.