Re: Auth backends don't work with HttpResponseRedirect and Django 1.4+?
On Mon, Oct 14, 2013 at 1:52 PM, Hanne Moa <hanne.moa@gmail.com> wrote:
> I can't get logging in with alternate auth backends to work with Django 1.4
> or newer.
>
> Basically:
>
> 1. authenticate() works. request.user.is_authenticated() is True
> 2. Django's own login() seems to work, as request.user is set,
> request.session is set etc.
> 3. After the HttpResponseRedirect, request.user is AnonymousUser
>
> This has happened twice now, with different alternate auth backends. I can't
> get rid of Django 1.3 before this is fixed...
>
> In one project I can call the next view directly (with render) and it Just
> Works. In the current project, the next view contains a form, and the
> "login" doesn't survive the POST.
>
> What am I missing? See also the non-solution in
> http://stackoverflow.com/questions/16119155/django-request-user-not-set-after-redirect
>
Are you sure sessions are working correctly? Are you setting cookies
(for session or otherwise) with a different host name than you are
serving from?
Use a browser that allows you to inspect and capture web requests
(chrome, firefox etc), capture the login sequence and look at the
cookies that are being set.
Cheers
Tom
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFHbX1%2BJG9qmAYCk5bEvK%2BOa6YdQ3CiJuKN3gRka6SzfvK7fhw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home