Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FBSDKLoginManager with FBSDKLoginBehaviorWeb failing with "Not Logged In" error

Tags:

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):

enter image description here

(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).

like image 355
devios1 Avatar asked Aug 12 '15 23:08

devios1


1 Answers

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. :)

enter image description here

like image 141
andersryanc Avatar answered Sep 26 '22 00:09

andersryanc