code style clean up

pull/72/head
Christopher Usher 5 years ago
parent f4d0fbf42e
commit 4779d88e37

@ -8,11 +8,10 @@ setup(
"argh", "argh",
"flask", "flask",
"gevent", "gevent",
"google-auth",
"psycogreen", "psycogreen",
"psycopg2", "psycopg2",
"requests", "requests",
"six",
"google-auth",
"wubloader-common", "wubloader-common",
], ],
) )

@ -47,18 +47,15 @@ def auth_test():
try: try:
# Alternate method, query this endpoint: https://oauth2.googleapis.com/tokeninfo?id_token=XYZ123 # Alternate method, query this endpoint: https://oauth2.googleapis.com/tokeninfo?id_token=XYZ123
idinfo = id_token.verify_oauth2_token(userToken, requests.Request(), None) idinfo = id_token.verify_oauth2_token(userToken, requests.Request(), None)
if idinfo['iss'] not in ['accounts.google.com', 'https://accounts.google.com']: if idinfo['iss'] not in ['accounts.google.com', 'https://accounts.google.com']:
raise ValueError('Wrong issuer.') raise ValueError('Wrong issuer.')
# ID token is valid. Get the user's Google Account ID from the decoded token. # ID token is valid. Get the user's Google Account ID from the decoded token.
# userid = idinfo['sub'] # userid = idinfo['sub']
userEmail = idinfo['email'] userEmail = idinfo['email']
return json.dumps(userEmail) return json.dumps(userEmail)
except ValueError: except ValueError:
# Invalid token # Invalid token
pass return 'Invalid token. Access denied.', 403
else: else:
return "Hello World!" return "Hello World!"

Loading…
Cancel
Save