Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions oauth2client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1405,8 +1405,10 @@ def verify_id_token(id_token, audience, http=None,
def _urlsafe_b64decode(b64string):
# Guard against unicode strings, which base64 can't handle.
b64string = b64string.encode('ascii')
padded = b64string + '=' * (4 - len(b64string) % 4)
return base64.urlsafe_b64decode(padded)
padded = b64string + b'=' * (4 - len(b64string) % 4)
decoded = base64.urlsafe_b64decode(padded)
decoded = bytes.decode(decoded)
return decoded


def _extract_id_token(id_token):
Expand Down Expand Up @@ -1682,6 +1684,7 @@ def step2_exchange(self, code, http=None):

resp, content = http.request(self.token_uri, method='POST', body=body,
headers=headers)
content = bytes.decode(content)
d = _parse_exchange_token_response(content)
if resp.status == 200 and 'access_token' in d:
access_token = d['access_token']
Expand Down