I\'m trying to get through the process of authenticating a Google token for accessing a user\'s calendar within a Django application. Although I\'ve followed several indications
I have struggled exact the same issue for several hours, and I figured out the solution of which @Ryan Spaulding and @Hans Z answered. It works!
This is due to the fact Django 1.7 returns a unicode object for the state variable above using request.REQUEST. I was previously using Django 1.6 which used to return a string.
One can find more detail here. https://github.com/google/google-api-python-client/issues/58 I wrote this post for future reference.
if not xsrfutil.validate_token(
settings.SECRET_KEY,
str(request.REQUEST['state']),
request.user):
return HttpResponseBadRequest()