Skip to content

Instantly share code, notes, and snippets.

@Megabytemb
Created August 14, 2016 23:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Megabytemb/f07278ab3d7a967fb3e1eb92c6f033b0 to your computer and use it in GitHub Desktop.
Save Megabytemb/f07278ab3d7a967fb3e1eb92c6f033b0 to your computer and use it in GitHub Desktop.
Some of the dirtiest logon code i've ever created.
def is_logged_in():
if flask.session.has_key("profile_complete"):
"""
For every request, we're going to make sure that the user is Authenticated with Google.
This way we can make sure that when an account is disabled in Google, this Application
immediately stops working.
Its dirty and slow, but it works.
"""
http = oauth2.http()
resp, content = http.request(
'https://www.googleapis.com/plus/v1/people/me/openIdConnect')
return resp["status"] == "200"
else:
return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment