In my ASP.net MVC app, I'd like to log a user out of Facebook on their local bro开发者_C百科wser so that when they click the authentication button, they're forced to enter their credentials, even if they were previously logged into Facebook. I'd like to also do this after they're done authenticating, too. The end goal being that users will be able to enter credentials for multiple Facebook accounts.
So how can I log a user out of facebook programatically?
Unless you are a dev at Facebook I don't see this happening. You would need to nuke whatever persistent cookie Facebook puts on their users' machines and you are going to have a very difficult time doing that from your web application without relying on some sort of browser exploit.
Browsers were designed to keep walls up between apps to prevent this very kind of behavior.
Also imagine how upset you would be if you discovered another app was logging your users out. :)
I think there's a way to do this,
The facebook.com cookies are the same as apps.facebook.com. After logging the user out through the api, try cleaning the session/cookies. I believe that should take care of it.
I remember that facebook's API for log out used to have some issues and you had to do some workarounds to make it do what you want it to do. I don't know if they have fixed this yet or not.
But don't give up, there's a way to do this.
-Roozbeh
精彩评论