fix: fix error in sign_bytes (#905)
* fix: fix error in sign_bytes
* fix test
diff --git a/google/auth/impersonated_credentials.py b/google/auth/impersonated_credentials.py
index b8a6c49..80d6fdf 100644
--- a/google/auth/impersonated_credentials.py
+++ b/google/auth/impersonated_credentials.py
@@ -290,6 +290,11 @@
url=iam_sign_endpoint, headers=headers, json=body
)
+ if response.status_code != http_client.OK:
+ raise exceptions.TransportError(
+ "Error calling sign_bytes: {}".format(response.json())
+ )
+
return base64.b64decode(response.json()["signedBlob"])
@property