in options.go [91:114]
func WithCredentialsJSON(b []byte) Option {
return func(d *dialerConfig) {
c, err := credentials.DetectDefault(&credentials.DetectOptions{
Scopes: []string{sqladmin.SqlserviceAdminScope},
CredentialsJSON: b,
})
if err != nil {
d.err = errtype.NewConfigError(err.Error(), "n/a")
return
}
d.authCredentials = c
// Create another set of credentials scoped to login only
scoped, err := credentials.DetectDefault(&credentials.DetectOptions{
Scopes: []string{iamLoginScope},
CredentialsJSON: b,
})
if err != nil {
d.err = errtype.NewConfigError(err.Error(), "n/a")
return
}
d.iamLoginTokenProvider = scoped.TokenProvider
d.setCredentials = true
}
}