I would like to add the login feature of the reddit API, but the cookie is not being saved. The following code is being called in a custom Authentication Backend, which is installed higher in the stack than Django's own ModelBackend.
response = requests.post(REDDIT_LOGIN_URL, data={'user' : username,
'passwd' : password})
cookie = SimpleCookie()
cookie.load(response.headers.get('set-cookie'))
printing cookie['reddit_session'] returns a Morsel (obfuscated)
<Morsel: reddit_session='5356323%2C2012-05-15T17%3A15%3A08%xxxxxxxxxxxx7a4f25351b003a2484'>
This Cookie, however, is nowhere found in my browser. When the page is reloaded, my reddit session is gone, and I can not use other reddit API calls unless I create this session again. When I use the Chrome developer tools to look at my cookies, I see an entry under Resources > Cookies called "blank". When I click this, all I get is a white page with "This site has no cookies"
I am doing this in django-1.4, with
SESSION_ENGINE = "django.contrib.sessions.backends.signed_cookies"
enabled in settings.py. I tried it without with the same results.
Am I missing something here? I've tried using narwa as well, and the cookie is not being saved either. My cookies are definitely enabled in my browser as the same Django session is saving the django_language and session_id cookies.
Any pointers or answers are appreciated.