From ca8d98ab2e5277e53ab8df78beb1e75cdf5321e3 Mon Sep 17 00:00:00 2001 From: Aniruddha Maru Date: Fri, 15 May 2020 14:52:50 -0700 Subject: [PATCH] fix: signBytes for impersonated credentials (#506) * fix: signBytes doesn't work for impersonated credentials Fixes #338 * black --- google/auth/impersonated_credentials.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/google/auth/impersonated_credentials.py b/google/auth/impersonated_credentials.py index 84df484a4..429980210 100644 --- a/google/auth/impersonated_credentials.py +++ b/google/auth/impersonated_credentials.py @@ -264,7 +264,10 @@ def sign_bytes(self, message): iam_sign_endpoint = _IAM_SIGN_ENDPOINT.format(self._target_principal) - body = {"payload": base64.b64encode(message), "delegates": self._delegates} + body = { + "payload": base64.b64encode(message).decode("utf-8"), + "delegates": self._delegates, + } headers = {"Content-Type": "application/json"}