1

サードパーティのログインとログアウトにpython-social-authを使用しています。 Facebook、Twitter、Google Plusでサインインすると、最初は成功しました(ユーザー名/メールアドレスとパスワードを尋ねます)。私の問題は、ログアウトしてからどちらかを使って再度サインインすると、ユーザー名/電子メールとパスワードをもう一度聞かなくても自動的にサインインされます。私はログアウトしていませんか?python-social-authでログアウト

これは私のdisconnect pipelineです:

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)) 
+0

これを試してみてください: http://stackoverflow.com/questions/14529815/logout- with-django-social-auth –

+0

@NuranAfrasiyabovこの質問を見て、すべての解決策を試しましたが、それは私を助けませんでした。それでもFacebook、Twitter、Google Plusはログアウトしてもログインしています。 –

答えて

1

だから私は私のウェブサイトでこれをテストしています。 http://python-social-auth.readthedocs.io/en/latest/logging_out.html ソーシャルアプリから切断するには、disconnect(Disconnectはあなたのプロジェクトで「自分のアカウントを忘れる」ことができる方法です)を使用する必要があります。これであなたのDB内のsocial_auth_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', 
) 

:ナンバー5グーグル-oatuh2後の最初の行で

<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> 

は、DBテーブル内のユーザIDを示します。したがって、下の写真の最初のユーザーは私のアプリから削除/切断されます。 切断機能が動作するかどうかを確認するには、ユーザ関連付けが削除されているかどうかをsocial_auth_usersocialauthの表で確認してください。 enter image description here しかし、あなたが自分のアプリケーションにFacebook、Googleを介して接続するたびに、それはあなたがGoogleやFacebookのウェブサイトにもログインしていることを意味します(最初のログイン時にはFacebookやGoogleのログインページが開きます)。自分のアプリから切断しても、FacebookやGoogleのウェブサイトからログアウトする必要があります。そうしないと、ブラウザにログインしたままになります。また、ウェブアプリに再度接続しようとすると、自動的にログインします。

関連する問題