diff --git a/storage/remote/googleiam/googleiam.go b/storage/remote/googleiam/googleiam.go index 0ca7185ab7..2095ee9747 100644 --- a/storage/remote/googleiam/googleiam.go +++ b/storage/remote/googleiam/googleiam.go @@ -19,7 +19,6 @@ import ( "context" "fmt" "net/http" - "os" "golang.org/x/oauth2/google" "google.golang.org/api/option" @@ -42,15 +41,7 @@ func NewRoundTripper(cfg *Config, next http.RoundTripper) (http.RoundTripper, er option.WithScopes(scopes), } if cfg.CredentialsFile != "" { - credBytes, err := os.ReadFile(cfg.CredentialsFile) - if err != nil { - return nil, fmt.Errorf("error reading Google credentials file: %w", err) - } - creds, err := google.CredentialsFromJSON(ctx, credBytes, scopes) - if err != nil { - return nil, fmt.Errorf("error parsing Google credentials file: %w", err) - } - opts = append(opts, option.WithCredentials(creds)) + opts = append(opts, option.WithAuthCredentialsFile(option.ServiceAccount, cfg.CredentialsFile)) } else { creds, err := google.FindDefaultCredentials(ctx, scopes) if err != nil {