Created
October 24, 2013 03:34
-
-
Save chriskief/7130876 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): | |
# Twitter will direct with oauth_token and oauth_verifier in the URL | |
# ?oauth_token=EoSsg1...&oauth_verifier=NB3bvAkb... | |
# did the user deny the request | |
if 'denied' in request.GET: | |
return False | |
# ensure we have a session state and the state value is the same as what twitter returned | |
if 'twitter_request_token_key' not in request.session \ | |
or 'oauth_token' not in request.GET \ | |
or 'oauth_verifier' not in request.GET \ | |
or request.session['twitter_request_token_key'] != request.GET['oauth_token']: | |
return False | |
else: | |
return True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment