FBSDKLoginManager with FBSDKLoginBehaviorWeb failing with “Not Logged In” error

馋奶兔 提交于 2019-11-27 06:36:39

问题


Something must have changed recently on Facebook's servers regarding how they process login requests because this used to be working perfectly and suddenly stopped.

(We are using FBSDKLoginManager.loginBehavior = FBSDKLoginBehaviorWeb because of how our app is replicated for multiple brands (one codebase, many apps) and issues we ran into using the native login.)

Anyhow, this is what we see now when we try to present a login webview to the user (before it even lets them attempt to login):

(Not Logged In: You are not logged in. Please login and try again.)

This is the code we are using to present the login view:

NSString *const publish_actions = @"publish_actions";
FBSDKLoginManager* login = [FBSDKLoginManager new];
login.loginBehavior = FBSDKLoginBehaviorWeb;
[login logInWithPublishPermissions:@[publish_actions] handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
    [FBSDKAccessToken setCurrentAccessToken:result.token];
    // ...
}];

Also note that this problem is not specific to iOS. Our Android app is seeing the same thing (and again it used to work fine until just recently).


回答1:


I was having this same bug... seems as though the issue lies in your info.plist URL Scheme settings: Facebook SDK: app not registered as a URL Scheme

However, adding these leads to the app sending you off to the actual Facebook app for authentication, instead of showing the login modal in your own app.

** UPDATE **

Sorry, I spoke too soon... the above changes will help things out (or change the user flow in ways you don't want), but what really needed to happen (and this is the only thing), was just adding an "iOS Platform" (or other) to your app settings in the Facebook Developer portal. This is what did it for me anyways. :)



来源:https://stackoverflow.com/questions/31977310/fbsdkloginmanager-with-fbsdkloginbehaviorweb-failing-with-not-logged-in-error

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