diff --git a/google/oauth2/_id_token_async.py b/google/oauth2/_id_token_async.py index 20630e0d4..b90994cdc 100644 --- a/google/oauth2/_id_token_async.py +++ b/google/oauth2/_id_token_async.py @@ -95,7 +95,7 @@ async def _fetch_certs(request, certs_url): data = await response.data.read() - return json.loads(json.dumps(data)) + return json.loads(data.decode("utf-8")) async def verify_token( diff --git a/system_tests/secrets.tar.enc b/system_tests/secrets.tar.enc index 9baa3acd2..31e079b4e 100644 Binary files a/system_tests/secrets.tar.enc and b/system_tests/secrets.tar.enc differ diff --git a/tests_async/oauth2/test_id_token.py b/tests_async/oauth2/test_id_token.py index b84e74db2..a52b8b4e0 100644 --- a/tests_async/oauth2/test_id_token.py +++ b/tests_async/oauth2/test_id_token.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import json import os import mock @@ -32,7 +33,9 @@ def make_request(status, data=None): if data is not None: response.data = mock.AsyncMock(spec=["__call__", "read"]) - response.data.read = mock.AsyncMock(spec=["__call__"], return_value=data) + response.data.read = mock.AsyncMock( + spec=["__call__"], return_value=json.dumps(data).encode("utf-8") + ) request = mock.AsyncMock(spec=["transport.Request"]) request.return_value = response