简体   繁体   English

在Facebook IOS SDK中禁用单点登录(SSO)

[英]Disable Single Sign On (SSO) in Facebook IOS SDK

We've built an iOS app that uses the Facebook SDK. 我们已经构建了一个使用Facebook SDK的iOS应用程序。 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). 不幸的是,我们的客户要求我们在应用程序中禁用后台处理,这意味着Facebook单点登录(SSO)方案对我们不起作用(因为我们的应用程序现在在登录/授权后启动时从头开始在Facebook应用程序)。

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? 所以问题是:我们可以在Facebook iOS SDK中禁用SSO,使其行为与旧的SDK版本中的行为一样,Facebook登录/授权在应用程序内的Web视图中发生吗?

Open Facebook.m file in FBconnect library and find: 在FBconnect库中打开Facebook.m文件,找到:

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

set: 组:

   [self authorizeWithFBAppAuth:NO safariAuth:NO];

And FBconnect will authorize only with inside popup... 并且FBconnect只会使用内部弹出窗口授权..​​.

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). 我不知道你可以禁用sso但是我有一个技巧可以做到这一点。(每次都需要凭证登录facebook)。

write these line in appDelegate's d idFinishLaunchingWithOptions method idFinishLaunchingWithOptions的d idFinishLaunchingWithOptions方法中写下这些行

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];
}

[self authorizeWithFBAppAuth:NO safariAuth:NO];

you can save the state of your app before calling the facebook authentification process. 您可以在调用facebook身份验证过程之前保存应用程序的状态。 but if the FB app is on the phone of your user, the 但如果FB应用程序在您的用户的手机上,那么

[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. 但是,如果您只有基本需求,则可以使用FB SDK的webview部分。 Using: 使用:

[facebook authorize:permissions delegate:self]

will make FB SDK displays a webview which will take care of the authorization process. 将使FB SDK显示一个webview,它将负责授权过程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM