Skip to content

Commit 9424d57

Browse files
authored
fix: specify scope for WithCredentialsFile/JSON (#29)
1 parent 6dd26a3 commit 9424d57

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

options.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ import (
2828
apiopt "google.golang.org/api/option"
2929
)
3030

31+
const CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
32+
3133
// An Option is an option for configuring a Dialer.
3234
type Option func(d *dialerConfig)
3335

@@ -71,7 +73,8 @@ func WithCredentialsFile(filename string) Option {
7173
// or refresh token JSON credentials to be used as the basis for authentication.
7274
func WithCredentialsJSON(b []byte) Option {
7375
return func(d *dialerConfig) {
74-
c, err := google.CredentialsFromJSON(context.Background(), b) // TODO: add AlloyDB scope
76+
// TODO: Use AlloyDB-specfic scope
77+
c, err := google.CredentialsFromJSON(context.Background(), b, CloudPlatformScope)
7578
if err != nil {
7679
d.err = errtype.NewConfigError(err.Error(), "n/a")
7780
return

0 commit comments

Comments
 (0)