Created
August 14, 2016 23:56
-
-
Save Megabytemb/f07278ab3d7a967fb3e1eb92c6f033b0 to your computer and use it in GitHub Desktop.
Some of the dirtiest logon code i've ever created.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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