Skip to content

Instantly share code, notes, and snippets.



Created Oct 24, 2013
What would you like to do?
def verify(request):
# Google will direct with state and code in the URL
# ?state=zNHRjuYO...&code=4/zK5F93g2we...
# ensure we have a session state and the state value is the same as what google returned
if 'google_state' not in request.session \
or 'state' not in request.GET \
or 'code' not in request.GET \
or request.session['google_state'] != request.GET['state']:
return False
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment