zhuyxn
zhuyxn

Reputation: 7091

Logging out in Django Facebook?

Using Django-facebook for the first time.

  1. For some reason, if i log in with facebook, but later log out of my Facebook account. My application stays logged in with the default Django user, with an expired session token because "the user has logged out". If I then re-log in to facebook, the Django app stays "logged out" of Facebook.

  2. In the case above, I have tried attaching @facebook_required_lazy to the top of my view function, but to no effect. What is the intended behavior of this decorator in this use case? The view contains a call to get_persistent_graph.

Upvotes: 2

Views: 354

Answers (1)

janos
janos

Reputation: 124714

Your Django login session is completely independent from your Facebook login session. Facebook is used to authenticate only, that is at the time of the login. But the login sessions are independent, not connected. Thus, logging out from Facebook does not affect your Django session at all. It is normal that you are still logged in on Django.

To logout from Django you need to use the logout method of the Django framework, in module django.contrib.auth, for example with a custom logout method like this:

from django.contrib.auth import logout as django_logout

def logout(request):
    django_logout(request)
    return some_other_view(request)

Upvotes: 1

Related Questions