I have used django package social_auth to implement facebook login on my website. I am able to log in correctly and get all the data. But I am not able to logout.
I am not using django.user.login and logout. I am using socialauth_begin and socialauth_disconnect
I am able to login, go in the social auth pipeline, get the necessary information, but I am not able to logout. What is the fix to this problem?
When I click on "Logout" in Logout I get the following error
NotAllowedToDisconnect at /tomonotomo/auth/disconnect/facebook/
No exception supplied
Request Method: GET
Request URL: http://localhost:8000/tomonotomo/auth/disconnect/facebook/
Django Version: 1.5.1
Exception Type: NotAllowedToDisconnect
Exception Location: /tmp/guest-onyOH9/pratik/virtualenv-1.10/tomonotomo/local/lib/python2.7/site-packages/social_auth/backends/__init__.py in disconnect, line 435
Python Executable: /tmp/guest-onyOH9/pratik/virtualenv-1.10/tomonotomo/bin/python2.7
Python Version: 2.7.3
Python Path:
['/tmp/guest-onyOH9/pratik/tomonotomo_project',
'/tmp/guest-onyOH9/Desktop/pycharm-2.7.3/helpers/pydev',
'/tmp/guest-onyOH9/pratik/tomonotomo_project',
'/tmp/guest-onyOH9/pratik/virtualenv-1.10/tomonotomo/lib/python2.7',
'/tmp/guest-onyOH9/pratik/virtualenv-1.10/tomonotomo/lib/python2.7/plat-linux2',
'/tmp/guest-onyOH9/pratik/virtualenv-1.10/tomonotomo/lib/python2.7/lib-tk',
'/tmp/guest-onyOH9/pratik/virtualenv-1.10/tomonotomo/lib/python2.7/lib-old',
'/tmp/guest-onyOH9/pratik/virtualenv-1.10/tomonotomo/lib/python2.7/lib-dynload',
'/usr/lib/python2.7',
'/usr/lib/python2.7/plat-linux2',
'/usr/lib/python2.7/lib-tk',
'/tmp/guest-onyOH9/pratik/virtualenv-1.10/tomonotomo/local/lib/python2.7/site-packages',
'/tmp/guest-onyOH9/pratik/virtualenv-1.10/tomonotomo/lib/python2.7/site-packages']
Server time: Sat, 10 Aug 2013 22:27:42 -0500
The settings I have is this:
AUTHENTICATION_BACKENDS = (
'social_auth.backends.facebook.FacebookBackend',
'django.contrib.auth.backends.ModelBackend',
)
FACEBOOK_EXTENDED_PERMISSIONS= ['email', 'user_birthday']
SOCIAL_AUTH_PIPELINE = (
'social_auth.backends.pipeline.social.social_auth_user',
'social_auth.backends.pipeline.associate.associate_by_email',
'social_auth.backends.pipeline.user.get_username',
'social_auth.backends.pipeline.user.create_user',
'tomonotomo.social_auth_pipeline.create_custom_user',
'social_auth.backends.pipeline.social.associate_user',
'social_auth.backends.pipeline.user.update_user_details',
)
SOCIAL_AUTH_CREATE_USERS = True
SOCIAL_AUTH_FORCE_RANDOM_USERNAME = False
SOCIAL_AUTH_DEFAULT_USERNAME = 'socialauth_user'
SOCIAL_AUTH_ENABLED_BACKENDS = ('facebook',)
SOCIAL_AUTH_COMPLETE_URL_NAME = 'socialauth_complete'
SOCIAL_AUTH_ASSOCIATE_URL_NAME = 'socialauth_associate_complete'
SOCIAL_AUTH_ASSOCIATE_BY_EMAIL = True
SOCIAL_AUTH_ERROR_KEY = 'socialauth_error'
SOCIAL_AUTH_REDIRECT_IS_HTTPS = False
LOGIN_URL = '/tomonotomo/login/'
LOGIN_REDIRECT_URL = '/tomonotomo/'
LOGIN_ERROR_URL = '/tomonotomo/login-error/'
Please Help. Thanks
The code I used to Login was:
<a href="{% url "socialauth_begin" "facebook" %}" class="btn"><h3 style="color:white">Connect via Facebook</h3></a>