@@ -143,11 +143,11 @@ func (s serviceAccountSigner) Email(ctx context.Context) (string, error) {
143
143
return s .clientEmail , nil
144
144
}
145
145
146
- // iamSigner is a cryptoSigner that signs data by sending them to the remote IAM service. See
147
- // https://cloud.google.com/iam/reference/rest/v1/projects.serviceAccounts/signBlob for details
148
- // regarding the REST API.
146
+ // iamSigner is a cryptoSigner that signs data by sending them to the IAMCredentials service. See
147
+ // https://cloud.google.com/iam/docs/ reference/credentials/ rest/v1/projects.serviceAccounts/signBlob
148
+ // for details regarding the REST API.
149
149
//
150
- // The IAM service requires the identity of a service account. This can be specified explicitly
150
+ // IAMCredentials requires the identity of a service account. This can be specified explicitly
151
151
// at initialization. If not specified iamSigner attempts to discover a service account identity by
152
152
// calling the local metadata service (works in environments like Google Compute Engine).
153
153
type iamSigner struct {
@@ -169,7 +169,7 @@ func newIAMSigner(ctx context.Context, config *internal.AuthConfig) (*iamSigner,
169
169
httpClient : hc ,
170
170
serviceAcct : config .ServiceAccountID ,
171
171
metadataHost : "http://metadata.google.internal" ,
172
- iamHost : "https://iam .googleapis.com" ,
172
+ iamHost : "https://iamcredentials .googleapis.com" ,
173
173
}, nil
174
174
}
175
175
@@ -181,15 +181,15 @@ func (s iamSigner) Sign(ctx context.Context, b []byte) ([]byte, error) {
181
181
182
182
url := fmt .Sprintf ("%s/v1/projects/-/serviceAccounts/%s:signBlob" , s .iamHost , account )
183
183
body := map [string ]interface {}{
184
- "bytesToSign " : base64 .StdEncoding .EncodeToString (b ),
184
+ "payload " : base64 .StdEncoding .EncodeToString (b ),
185
185
}
186
186
req := & internal.Request {
187
187
Method : http .MethodPost ,
188
188
URL : url ,
189
189
Body : internal .NewJSONEntity (body ),
190
190
}
191
191
var signResponse struct {
192
- Signature string `json:"signature "`
192
+ Signature string `json:"signedBlob "`
193
193
}
194
194
if _ , err := s .httpClient .DoAndUnmarshal (ctx , req , & signResponse ); err != nil {
195
195
return nil , err
0 commit comments