I'm working on PhoneGap and have a FBConnect. Using childBrowser and the blog'http://www.pushittolive.com/post/1239874936/facebook-login-on-iphone-phonegap', I have logged in to the App. But could not logout from the app. It's autosigned in for each time I login.
Can any one tell me how to logout from the FBConnect using Childbrowsern PhoneGap?
Try this.
Add this function to ChildBrowserCommand.m
-(void) deleteCookies:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options{
NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for (NSHTTPCookie *each in [cookieStorage cookies]) {
[cookieStorage deleteCookie:each];
}
}
Add this to Childbrowser.js
ChildBrowser.prototype.LogOut = function()
{
PhoneGap.exec("ChildBrowserCommand.deleteCookies");
}
Add this to FBConnect.js
FBConnect.prototype.Logout = function()
{
window.plugins.childBrowser.LogOut();
}
At your page add this code to logout button on click
function Logout()
{
var fb=FBConnect.install();
fb.Logout();
}
Enjoy.
Best way to tell facebook to logout.
It can Be done by opening below url in child browser:
"https://www.facebook.com/logout.php?next="+your_site_url_registered _on_fb+"&access_token="+accessToken
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With