python-social-auth在Django自定义重定向网址 [英] python-social-auth custom redirect url in Django
问题描述
我正在使用 python-social-auth
包与Django一起管理oauth和openID登录。
I am using python-social-auth
package along with Django to manage oauth and openID logins.
现在的问题是,我可以在django settings.py
中指定一个重定向网址,但在某些情况下,我希望将用户重定向到他发起的同一页面验证过程。
Now the issue is that, I can specify one redirect url in django settings.py
, but in some case I want the user to be redirected to the same page from which he initiated the authentication process.
例如:如果我的重定向网址是: / home /
而我目前在一个页面 / products / product1
从中我认证用户,然后我希望用户被重定向到 / products / product1 /
而不是 / home /
E.g: if my redirect url is : /home/
and I am currently in a page /products/product1
from which I authenticate the user, then I want the user to be redirected to /products/product1/
rather than /home/
请帮我解决这个问题,或至少一些详细的材料
Please help me solve this problem or at least some materials that covers this in detail.
提前感谢
推荐答案
我拉你的答案出来的问题,并将其放在这里供将来参考。
I'm pulling your answer out of the question and placing it here for future reference.
添加参数?next = {{request.get_full_path}}
到 auth
url。
Adding a parameter ?next={{request.get_full_path}}
to the auth
url.
这篇关于python-social-auth在Django自定义重定向网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!