From 688d47c7e99813495465000ec19edc75f0da346c Mon Sep 17 00:00:00 2001 From: Joao Marcal Date: Mon, 4 Mar 2024 17:58:38 +0000 Subject: [PATCH] GCS: adds scope to fix bug introduced in https://github.com/thanos-io/objstore/pull/86 Issue was reported in https://github.com/thanos-io/objstore/pull/106#issuecomment-1971490145 --- providers/gcs/gcs.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/providers/gcs/gcs.go b/providers/gcs/gcs.go index c9ee1601..75c61303 100644 --- a/providers/gcs/gcs.go +++ b/providers/gcs/gcs.go @@ -113,6 +113,10 @@ func NewBucketWithConfig(ctx context.Context, logger log.Logger, gc Config, comp } } + // GCS uses some defaults when "options.WithHTTPClient" is not used that are important when we call + // htransport.NewTransport namely the scopes that are then used for OAth authentication. So to build our own + // http client we need to se those defaults + opts = append(opts, option.WithScopes(storage.ScopeFullControl, "https://www.googleapis.com/auth/cloud-platform")) gRT, err := htransport.NewTransport(context.Background(), rt, opts...) if err != nil { return nil, err