Logout with facebook


Question

How can I log a user out from my facebook connect website, without using the fb-login button? I would like to do it from codebehind (c#)?

1
8
4/30/2013 11:49:55 AM

Accepted Answer

I found out that there was only an option to do it from Javascript by FB.logout(). It seems kinda wird that there is no API from codebehind to do the same.

10
10/16/2011 12:23:12 PM

If you just want a simple link to log out the user, you can form a url like this:

https://www.facebook.com/logout.php?access_token=ACCESS_TOKEN&confirm=1&next=REDIRECT

Just replace ACCESS_TOKEN and REDIRECT with the appropriate values. Facebook changes this every now and then, so you have to watch out for that. This only works in the browser, but the nice thing about doing it this way is that the user doesn't have to wait for the JavaScript library to load.


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon