简体   繁体   English

python-social-auth-如何在Django中断开连接?

[英]python-social-auth - how could I disconnect in Django?

I'm using a tag with href like /disconnect/backend/ and then it shows me an empty page. 我正在使用带有href a标签(例如/disconnect/backend/ ,然后显示空白页面。 I've tried {% url %} template tag like: 我已经尝试过{% url %}模板标记,例如:

{% url 'social:disconnect' 'twitter' %}

And it's still create same url as I've used in the tag. 而且它仍然创建与标记中相同的网址。 How could I disconnect account? 我如何断开帐户? Or maybe there are also a way to get only one account associated? 或者,也许还有一种方法只能关联一个帐户?

Answer is very simple. 答案很简单。 You should use POST request. 您应该使用POST请求。 I've done it like those: 我已经做到了:

<form action="{% url 'social:disconnect' 'twitter' %}" method="post">
    {% csrf_token %}
    <button class="btn btn-warning btn-xs">
        Disconnect
    </button>
</form>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM