Skip to content

Instantly share code, notes, and snippets.

Created Oct 24, 2013
What would you like to do?
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
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment