google: add authorized_user conditional to Credentials.UniverseDomain
Return default universe domain if credentials type is authorized_user. Change-Id: I20a9b5fafa562fcec84717914a236d081f630591 Reviewed-on: https://go-review.googlesource.com/c/oauth2/+/532196 Run-TryBot: Cody Oss <codyoss@google.com> Reviewed-by: Cody Oss <codyoss@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
@@ -216,6 +216,12 @@ func CredentialsFromJSONWithParams(ctx context.Context, jsonData []byte, params
|
||||
return nil, err
|
||||
}
|
||||
|
||||
universeDomain := f.UniverseDomain
|
||||
// Authorized user credentials are only supported in the googleapis.com universe.
|
||||
if f.Type == userCredentialsKey {
|
||||
universeDomain = universeDomainDefault
|
||||
}
|
||||
|
||||
ts, err := f.tokenSource(ctx, params)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -225,7 +231,7 @@ func CredentialsFromJSONWithParams(ctx context.Context, jsonData []byte, params
|
||||
ProjectID: f.ProjectID,
|
||||
TokenSource: ts,
|
||||
JSON: jsonData,
|
||||
universeDomain: f.UniverseDomain,
|
||||
universeDomain: universeDomain,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user