Disable Single Sign On (SSO) in Facebook IOS SDK

[亡魂溺海] 提交于 2019-12-03 22:47:49

问题


We've built an iOS app that uses the Facebook SDK. Unfortunately, our client has asked that we disable backgrounding in the app and this means that the Facebook single-sign on (SSO) scheme doesn't work for us (as our app now starts from scratch when it is launched after the login/authorisation in the Facebook app).

So the question is: can we disable SSO in the Facebook iOS SDK such that it behaves like it did in older SDK versions with the Facebook login/ authorization happening within an in-app web-view?


回答1:


Open Facebook.m file in FBconnect library and find:

- (void)authorize:(NSArray *)permissions
         delegate:(id<FBSessionDelegate>)delegate {

set:

   [self authorizeWithFBAppAuth:NO safariAuth:NO];

And FBconnect will authorize only with inside popup...




回答2:


I don't know you can disable sso or not but i have a trick to do this.(every time need credential for login on facebook).

write these line in appDelegate's didFinishLaunchingWithOptions method

NSHTTPCookieStorage* cookies = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for (NSHTTPCookie* cookie in
[[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies]) {
NSString *domainStr=(NSString *)[cookie domain];
NSLog(@"%@",domainStr);
if([domainStr isEqualToString:@".facebook.com" ])
{
[cookies deleteCookie:cookie];
}



回答3:


[self authorizeWithFBAppAuth:NO safariAuth:NO];




回答4:


you can save the state of your app before calling the facebook authentification process. but if the FB app is on the phone of your user, the

[facebook authorize:permissions delegate:self]

will redirect you to it.

But if you only have basic needs, you could use the webview part of the FB SDK. Using:

[facebook authorize:permissions delegate:self]

will make FB SDK displays a webview which will take care of the authorization process.



来源:https://stackoverflow.com/questions/6435578/disable-single-sign-on-sso-in-facebook-ios-sdk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!