Parvezkhan
Parvezkhan

Reputation: 381

Facebook Logout is not working in new SDK

Each time get authorized screen of user. I am not able to login with different user.I think issue is, safari stores cookies.

This may have bug in Facebook SDK.

Upvotes: 0

Views: 2371

Answers (3)

Carlo
Carlo

Reputation: 835

you have to import FBSDKLoginKit and then:

 FBSDKAccessToken.setCurrentAccessToken(nil)
 FBSDKProfile.setCurrentProfile(nil)

let manager = FBSDKLoginManager()
manager.logOut()

Upvotes: 0

Suresh Kumar Durairaj
Suresh Kumar Durairaj

Reputation: 2126

Open Safari, go to facebook.com website and logout. I think it's the 6th tab from the top in the mobile website, the logout option is at the bottom.

EDIT:

Reading safari cookies from third party applications is not possible, rather it would put the user privacy in pitfalls. As of now, this could be the possible way to login with different credentials at times.

And [FBSDKAccessToken setCurrentAccessToken:nil]; this can be just resets the sdk's accesstoken to nil, which enables the 'Logout' to 'Login with Facebook' and relaunches the safari facebook authroizing when it's clicked again.

Upvotes: -1

Kirit Modi
Kirit Modi

Reputation: 23397

1. Clear to facebookToken

 FBSDKAccessToken.setCurrentAccessToken(nil)
 FBSDKProfile.setCurrentProfile(nil)

2. Logout FBSDKLoginManager.

let manager = FBSDKLoginManager()
manager.logOut()

NOTE : its logout from apps if you choose FBSDKLoginBehavior is web that open Facebook Login page in UIWebView., if you choose Native then open Facebook Login page in safari browser and store data in safari.

let loginView : FBSDKLoginManager = FBSDKLoginManager()
loginView.loginBehavior = FBSDKLoginBehavior.Web

Upvotes: 6

Related Questions