diff --git a/api/base.py b/api/base.py index 236d20fe7..5ca25d645 100644 --- a/api/base.py +++ b/api/base.py @@ -67,8 +67,10 @@ def __init__(self, request=None, response=None): u = u._replace(query=urllib.urlencode(query, True)) provider_avatar = urlparse.urlunparse(u) else: - headers = {'WWW-Authenticate': 'Bearer realm="{}", error="invalid_token", error_description="Invalid OAuth2 token."'.format(site_id)} - self.abort(401, 'invalid oauth2 token', headers=headers) + err_msg = 'Invalid OAuth2 token.' + headers = {'WWW-Authenticate': 'Bearer realm="{}", error="invalid_token", error_description="{}"'.format(site_id, err_msg)} + log.warn('{} Request headers: {}'.format(err_msg, str(self.request.headers.items()))) + self.abort(401, err_msg, headers=headers) # 'Debug' (insecure) setting: allow request to act as requested user elif self.debug and self.get_param('user'):