【发布时间】:2015-01-12 23:35:00
【问题描述】:
我正在使用 python social auth 来使用社交登录,但成功登录后我无法重定向到最后一页。
例如,如果我在以下页面 http://localhost:8000/docprofile/14/ 并单击登录按钮,而不是将我重定向到最后一页 http://localhost:8000/docprofile/14/,它会将我重定向到登录页面。
如果我这样说:
<a href="{% url 'social:begin' 'facebook' %}?next={{ request.path }}"> | Login with Facebook</a>
它重定向到登录页面,并且 url 以奇怪的字符结尾:
http://localhost:8000/login/#_=_
我也试过这个:
<a href="{% url 'social:begin' 'facebook' %}?next={{ request.get_full_path }}"> | Login with Facebook</a>
这次它确实采用了 /docprofile/14 的路径,但仍然没有将我重定向回来,而是将我带到带有 url http://localhost:8000/login/?next=/docprofile/14/#_=_ 的登录页面
【问题讨论】:
-
除了重定向问题之外,身份验证工作正常吗?
-
@omab 是的,身份验证工作正常。只是重定向是问题!
-
你找到解决这个问题的办法了吗?
标签: python django redirect python-social-auth