Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't dynamically redirect to last visited page with django social auth

When on a specific event page. The user can login using django social auth, but will redirect them to a static url, with the option below

SOCIAL_AUTH_LOGIN_REDIRECT_URL = '/dashboard/'

I was wondering if there is a dynamic way of redirecting to the page where they logged in. I tried this, but it didn't work.

{% url socialauth_begin 'facebook' %}?redirect_uri={{ request.get_full_path }}

Any suggestions would be great thanks.

Matthew

like image 734
Matthew Harrison Avatar asked Jul 17 '13 16:07

Matthew Harrison


1 Answers

According to source code all you need is to set ?next=.

Like {% url socialauth_begin 'facebook' %}?next={{ request.get_full_path }} or another field name if setted REDIRECT_FIELD_NAME

like image 63
Andrey Nelubin Avatar answered Nov 04 '22 10:11

Andrey Nelubin