使用python social auth注销
我正在使用使用python social auth注销,python,django,authentication,python-social-auth,django-socialauth,Python,Django,Authentication,Python Social Auth,Django Socialauth,我正在使用pythonsocialauth进行第三方登录和注销。使用Facebook、Twitter和Google Plus登录一开始很成功(它会询问我的用户名/电子邮件和密码)。我的问题是,当我注销,然后通过其中任何一个再次登录时,我将自动登录,甚至不再询问我的用户名/电子邮件和密码。我没有注销吗 这是我的断开管道连接: SOCIAL_AUTH_DISCONNECT_PIPELINE = ( 'social.pipeline.disconnect.allowed_to_disconne
pythonsocialauth
进行第三方登录和注销。使用Facebook、Twitter和Google Plus登录一开始很成功(它会询问我的用户名/电子邮件和密码)。我的问题是,当我注销,然后通过其中任何一个再次登录时,我将自动登录,甚至不再询问我的用户名/电子邮件和密码。我没有注销吗
这是我的断开管道连接
:
SOCIAL_AUTH_DISCONNECT_PIPELINE = (
'social.pipeline.disconnect.allowed_to_disconnect',
'social.pipeline.disconnect.get_entries',
'social.pipeline.disconnect.revoke_tokens',
'social.pipeline.disconnect.disconnect',
)
这是我的注销视图:
from django.contrib.auth import logout as auth_logout
def logout(request):
auth_logout(request)
return render_to_response('logged-out.html', {}, RequestContext(request))
所以我已经在我的网站上测试过了。以下是解释注销和断开连接行为的链接: 正如您所见,要断开与社交应用程序的连接,您需要使用断开连接(断开连接是您的用户要求您的项目“忘记我的帐户”的方式)。这样,您就可以在数据库中的social\u auth\u usersocialauth表中删除用户关联。要做到这一点,您需要做以下几点:
**settings.py:**
SOCIAL_AUTH_DISCONNECT_PIPELINE = (
# Verifies that the social association can be disconnected from the current
# user (ensure that the user login mechanism is not compromised by this
# disconnection).
#'social.pipeline.disconnect.allowed_to_disconnect',
# Collects the social associations to disconnect.
'social.pipeline.disconnect.get_entries',
# Revoke any access_token when possible.
'social.pipeline.disconnect.revoke_tokens',
# Removes the social associations.
'social.pipeline.disconnect.disconnect',
)
在模板中:
<form id="myform" method="post" action="{% url 'social:disconnect' 'google-oauth2' %}5/?next={{request.path }}">
{% csrf_token %}
<input type="hidden" name="name" value="value" />
<a onclick="document.getElementById('myform').submit();">discon</a>
</form>
{%csrf_令牌%}
但问题是,每当你通过谷歌、facebook连接到自己的应用程序时,这意味着你也在登录谷歌或facebook网站(第一次登录时,它会打开facebook或谷歌的登录页面)。即使在你断开与自己应用程序的连接后,你也需要从facebook或谷歌网站注销。否则,浏览器将使您保持登录状态,当您再次尝试连接到web应用时,您将自动登录 试试这个:@NuranAfrasiyabov我已经看到了这个问题,并尝试了那里的每一个解决方案,但它没有帮助我。即使我退出,Facebook、Twitter和Google Plus仍然会登录。