@@ -143,11 +143,11 @@ func (s serviceAccountSigner) Email(ctx context.Context) (string, error) {
143143 return s .clientEmail , nil
144144}
145145
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.
149149//
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
151151// at initialization. If not specified iamSigner attempts to discover a service account identity by
152152// calling the local metadata service (works in environments like Google Compute Engine).
153153type iamSigner struct {
@@ -169,7 +169,7 @@ func newIAMSigner(ctx context.Context, config *internal.AuthConfig) (*iamSigner,
169169 httpClient : hc ,
170170 serviceAcct : config .ServiceAccountID ,
171171 metadataHost : "http://metadata.google.internal" ,
172- iamHost : "https://iam .googleapis.com" ,
172+ iamHost : "https://iamcredentials .googleapis.com" ,
173173 }, nil
174174}
175175
@@ -181,15 +181,15 @@ func (s iamSigner) Sign(ctx context.Context, b []byte) ([]byte, error) {
181181
182182 url := fmt .Sprintf ("%s/v1/projects/-/serviceAccounts/%s:signBlob" , s .iamHost , account )
183183 body := map [string ]interface {}{
184- "bytesToSign " : base64 .StdEncoding .EncodeToString (b ),
184+ "payload " : base64 .StdEncoding .EncodeToString (b ),
185185 }
186186 req := & internal.Request {
187187 Method : http .MethodPost ,
188188 URL : url ,
189189 Body : internal .NewJSONEntity (body ),
190190 }
191191 var signResponse struct {
192- Signature string `json:"signature "`
192+ Signature string `json:"signedBlob "`
193193 }
194194 if _ , err := s .httpClient .DoAndUnmarshal (ctx , req , & signResponse ); err != nil {
195195 return nil , err
0 commit comments