You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running the example in python3, the string signed_jwt ends up being a 'binary' string. Without the .decode('utf-8'), the Authorization header will not be formatted correctly and will result in a 'BAD_FORMAT' error response.
Consider adding the following comment above the Authorization line:
* "# add .decode('utf-8') to signed_jwt when running under python3"
The text was updated successfully, but these errors were encountered:
I should note the google_id_jwt function will still have Python3 issues as is, since httplib was renamed between versions. But this change adds full compatibility to make_request at least
In which file did you encounter the issue?
https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/endpoints/getting-started/clients/google-jwt-client.py
Did you change the file? If so, how?
Added .decode('utf-8') in below snippet:
def make_request(host, api_key, signed_jwt):
.
.
.
headers = {
'Authorization': 'Bearer {}'.format(signed_jwt.decode('utf-8'))
}
Describe the issue
When running the example in python3, the string signed_jwt ends up being a 'binary' string. Without the .decode('utf-8'), the Authorization header will not be formatted correctly and will result in a 'BAD_FORMAT' error response.
Consider adding the following comment above the Authorization line:
* "# add .decode('utf-8') to signed_jwt when running under python3"
The text was updated successfully, but these errors were encountered: