facebook connect logout not working

just few days ago i needed to integrate “facebook Connect” to a website. With the documentation provided by facebook it was quite easy to integrate it. But i faced one issue that i was not able to find out solution.

The problem: There is a method provide in Facebook php library : “get_loggedin_user()”  Now this function returns the profile id of the user if the user is logged in using facebook before landing to the website or after coming to the website(through facebook connect). But if i logged out of facebook, this function still returned me the profile id of that user one or more time after refreshing the page. due to which i was not able to log out of the website.

Solution: I searched the web for the solution and found few, but none of them worked for me. I tried to delete facebook cookies through facebook library functions and manually too but in vain. Finally i thought of a solution myself and it worked for me. The solution is when i logged out of the website i logged out of facebook and set a special session variable to 1. Now i will check if that variable is one i will not log in the website despite of getting profile id through “get_loggedin_user()”. and once page is loaded i will set that special session variable to 0.

This solved the issue for me for now.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s