From afbb019144bff46d919033fb5d74e7cffd41b70c Mon Sep 17 00:00:00 2001 From: "vadimsh@chromium.org" Date: Mon, 13 Apr 2015 23:26:31 +0000 Subject: [PATCH] Fix typo in Authorization header name. This code path is not actually used yet, so the typo wasn't caught earlier. Also make sure access tokens have 'str' type, not 'unicode'. R=nodir@chromium.org BUG=356813 Review URL: https://codereview.chromium.org/1082133002 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@294789 0039d316-1c4b-4281-b951-d872f2087c98 --- auth.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/auth.py b/auth.py index 789db6a4f..66137b592 100644 --- a/auth.py +++ b/auth.py @@ -329,13 +329,13 @@ class Authenticator(object): redirections=httplib2.DEFAULT_MAX_REDIRECTS, connection_type=None): headers = (headers or {}).copy() - headers['Authorizaton'] = 'Bearer %s' % self.get_access_token().token + headers['Authorization'] = 'Bearer %s' % self.get_access_token().token resp, content = request_orig( uri, method, body, headers, redirections, connection_type) if resp.status in client.REFRESH_STATUS_CODES: logging.info('Refreshing due to a %s', resp.status) access_token = self.get_access_token(force_refresh=True) - headers['Authorizaton'] = 'Bearer %s' % access_token.token + headers['Authorization'] = 'Bearer %s' % access_token.token return request_orig( uri, method, body, headers, redirections, connection_type) else: @@ -358,7 +358,7 @@ class Authenticator(object): return None if not credentials.access_token or credentials.access_token_expired: return None - return AccessToken(credentials.access_token, credentials.token_expiry) + return AccessToken(str(credentials.access_token), credentials.token_expiry) def _create_access_token(self, allow_user_interaction=False): """Mints and caches a new access token, launching OAuth2 dance if necessary. @@ -405,7 +405,7 @@ class Authenticator(object): credentials.token_expiry - datetime.datetime.utcnow()) credentials.set_store(storage) storage.put(credentials) - return AccessToken(credentials.access_token, credentials.token_expiry) + return AccessToken(str(credentials.access_token), credentials.token_expiry) ## Private functions.