diff --git a/api/pkg/auth/google_auth.go b/api/pkg/auth/google_auth.go index c1d33d31..bfea529b 100644 --- a/api/pkg/auth/google_auth.go +++ b/api/pkg/auth/google_auth.go @@ -55,7 +55,7 @@ func InitGoogleClient(ctx context.Context, audience string) (*http.Client, error return nil, err } - if len(cred.JSON) < 0 { + if len(cred.JSON) == 0 { return nil, fmt.Errorf("no default credentials found") } @@ -68,6 +68,9 @@ func InitGoogleClient(ctx context.Context, audience string) (*http.Client, error return idtoken.NewClient(ctx, audience) } else { defaultTokenSource, err := google.DefaultTokenSource(ctx) + if err != nil { + return nil, err + } tokenSource := oauth2.ReuseTokenSource(nil, &idTokenSource{TokenSource: defaultTokenSource}) var opts []idtoken.ClientOption