Skip to content
Snippets Groups Projects
Commit 8a5bdb26 authored by Gunnar Schaefer's avatar Gunnar Schaefer
Browse files

handle oauth resolution response w/o email

parent 4e007de8
No related branches found
No related tags found
No related merge requests found
......@@ -36,7 +36,9 @@ class RequestHandler(webapp2.RequestHandler):
r = requests.get(self.app.config['oauth2_id_endpoint'], headers={'Authorization': 'Bearer ' + access_token})
if r.status_code == 200:
identity = json.loads(r.content)
self.uid = identity['email']
self.uid = identity.get('email')
if not self.uid:
self.abort(400, 'OAuth2 token resolution did not return email address')
self.app.db.authtokens.save({'_id': access_token, 'uid': self.uid, 'timestamp': datetime.datetime.utcnow()})
log.debug('looked up remote token in %dms' % ((datetime.datetime.now() - token_request_time).total_seconds() * 1000.))
else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment