【问题标题】:I use python social auth with django. I can't disconnect from Steam我将 python social auth 与 django 一起使用。我无法断开与 Steam 的连接
【发布时间】:2016-07-16 23:30:29
【问题描述】:

我的模板:

{{ backends.associated }}
{{ backends.not_associated }}
{{ backends.backends }}
{{ status_page }}
{% if page_status == 'login' %}
    {% for soc in backends.backends %}
        <form action="{% url 'social:disconnect' soc %}" method="post">
            {% csrf_token %}
            <button type="submit">Disconnect</button>
        </form>
    {% endfor %}
{% endif %}
{% if page_status == 'start' %}
    <p>Стартовая страница</p>
    {% for soc in backends.backends %}
        <a href="{% url 'social:begin' soc %}">{{ soc }}</a>
    {% endfor %}
{% endif %}

我可以登录 Steam。但我无法断开连接。我什么都试过了。 错误:

NotAllowedToDisconnect at /disconnect/steam/

No exception message supplied

Request Method:     POST
Request URL:    https://sheltered-sea-35879.herokuapp.com/disconnect /steam/
Django Version:     1.9.7
Exception Type:     NotAllowedToDisconnect
Exception Location:     /app/.heroku/python/lib/python3.5/site-packages     /social/pipeline/disconnect.py in allowed_to_disconnect, line 7
Python Executable:  /app/.heroku/python/bin/python
Python Version:     3.5.2

出现此错误后,我必须从 Steam 中注销。我在文档中找不到信息。

【问题讨论】:

    标签: python django steam python-social-auth


    【解决方案1】:

    您的代码所做的只是解除您的 Steam 帐户与本地 django 用户的关联,而不是像这样与 Steam 断开连接。 如果您真的想断开与 Steam 的连接,则没有必要,当您执行 social:begin 链接时所发生的一切就是 Steam 提供的令牌与您的本地 django 用户相关联,该令牌将在您下次登录时使用django 网站。您[当前未连接到 Steam。

    PSA 仅允许您在 django 用户之后仍然可以登录的情况下取消关联社交帐户(即,它具有为用户定义的密码或仍与另一个社交媒体帐户相关联)

    【讨论】:

    • 谢谢!我之前也了解过,但是你的回答让我完全理解了。
    猜你喜欢
    • 2015-10-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-31
    • 1970-01-01
    • 2015-06-02
    • 1970-01-01
    • 2016-05-23
    相关资源
    最近更新 更多