forked from Mirrors/oauth2
google: add JSON field to DefaultCredentials
Change-Id: I9cde8eabf4a2cb87db74f7b805045e155fd4ef13 Reviewed-on: https://go-review.googlesource.com/51111 Reviewed-by: Jaana Burcu Dogan <jbd@google.com>
This commit is contained in:
parent
96fca6c793
commit
9a379c6b3e
|
@ -24,6 +24,12 @@ import (
|
|||
type DefaultCredentials struct {
|
||||
ProjectID string // may be empty
|
||||
TokenSource oauth2.TokenSource
|
||||
|
||||
// JSON contains the raw bytes from a JSON credentials file.
|
||||
// This field may be nil if authentication is provided by the
|
||||
// environment and not with a credentials file, e.g. when code is
|
||||
// running on Google Cloud Platform.
|
||||
JSON []byte
|
||||
}
|
||||
|
||||
// DefaultClient returns an HTTP Client that uses the
|
||||
|
@ -126,5 +132,6 @@ func readCredentialsFile(ctx context.Context, filename string, scopes []string)
|
|||
return &DefaultCredentials{
|
||||
ProjectID: f.ProjectID,
|
||||
TokenSource: ts,
|
||||
JSON: b,
|
||||
}, nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue