Python Social Auth NotAllowedToDisconnect at / disconnect / facebook / 1 /

I try to use logout with Python Social Auth in a Django application, but I get

NotAllowedToDisconnect at /disconnect/facebook/1/ 

These are my settings:

 SOCIAL_AUTH_PIPELINE = ( 'social.pipeline.social_auth.social_details', 'social.pipeline.social_auth.social_uid', 'social.pipeline.social_auth.auth_allowed', 'social.pipeline.social_auth.social_user', 'social.pipeline.user.get_username', 'social.pipeline.mail.mail_validation', 'social.pipeline.user.create_user', 'social.pipeline.social_auth.associate_user', 'social.pipeline.social_auth.load_extra_data', 'social.pipeline.user.user_details' ) SOCIAL_AUTH_DISCONNECT_PIPELINE = ( 'social.pipeline.disconnect.allowed_to_disconnect', 'social.pipeline.disconnect.get_entries', 'social.pipeline.disconnect.revoke_tokens', 'social.pipeline.disconnect.disconnect' ) 

And this is the code that I use in templates

 {{ assoc.provider }} (<a href="{% url 'social:disconnect_individual' assoc.provider assoc.id %}" class="disconnect">Disconnect </a>) 
+4
python django facebook
source share
1 answer

Provide a separate logout action to separate logout and shutdown.

 from django.contrib.auth import logout as auth_logout def logout(request): """Logs out user""" auth_logout(request) return render_to_response('home.html', {}, RequestContext(request)) 

Refer to the Django sample application for a complete example.

Your disconnected pipeline has social.pipeline.disconnect.allowed_to_disconnect . This will ensure that the user has a valid login method after the current login method has been disabled. This is the allowed_to_disconnect handle in django_orm.py # L23 .

To allow the diconnect user and avoid NotAllowedToDisconnect remove social.pipeline.disconnect.allowed_to_disconnect from your SOCIAL_AUTH_DISCONNECT_PIPELINE .

+5
source share

All Articles