Last active
December 26, 2015 09:39
-
-
Save chriskief/7130862 to your computer and use it in GitHub Desktop.
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 verify(request): | |
# Facebook will direct with state and code in the URL | |
# ?state=ebK3Np...&code=AQDJEtIZEDU...#_=_ | |
# ensure we have a session state and the state value is the same as what facebook returned | |
# also ensure we have a code from facebook (not present if the user denied the application) | |
if 'facebook_state' not in request.session \ | |
or 'state' not in request.GET \ | |
or 'code' not in request.GET \ | |
or request.session['facebook_state'] != request.GET['state']: | |
return False | |
else: | |
return True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment