Python Social auth redirect to the same url

After selecting some view with the login_required () decorator, the user is redirected to: http://example.com/login/ ? next = / anuncio / adicionar / , right?

But after I use "Login with facebook" the user is redirected to http://example.com/login/#= instead of http://example.com/anuncio/adicionar/

This only happens if I use python-social-auth, and it fails if I use auth native login.

My registration /login.html - Python Social Auth link

<a class="btn btn-social btn-fw btn-lg btn-facebook" href="{% url 'social:begin' 'facebook' %}?next={{ request.path }}"><i class="fa fa-facebook"></i> Fazer login com Facebook</a>

      

and my own auth entry

<form action="{% url "auth:login" %}" role="form" method="POST">{% csrf_token %}

      

+3


source to share


2 answers


Add login redirect url to setupins.py file

LOGIN_REDIRECT_URL = '/anuncio/adicionar/'

      



so when the user authenticates it redirects to the above url

+1


source


Try adding them to config.py

(if imported settings.py

, add if not settings.py

):

SOCIAL_AUTH_LOGIN_REDIRECT_URL = '/anuncio/adicionar/'
SOCIAL_AUTH_LOGIN_URL = '/login'

      



These definitions define the redirect URL after authenticating with facebook.

-2


source







All Articles