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).
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. :)
Related
My requirement is here:
Share to Facebook from my app using Open Graph Action - using Share Dialog (because I don't want special dialog for login)
I request publish permission, and upon obtaining it I try to share via Post dialog. Here is the brief code I use:
[FBRequestConnection startWithGraphPath:#"/MY_FB_APP_ID/app_link_hosts"
parameters:paramsForAppLinksHost HTTPMethod:#"POST"
completionHandler:^(FBRequestConnection *connection, id result, NSError *error)
{
NSString * appLinkHostURLID = [result objectForKey:#"id"]; // store this ID in an NSString
if(error)
{
NSLog(#"error = %#", error.description);
}
else
{
[self ShareToFB : appLinkHostURLID]; //Code to share OG story via Share Dialog
}
}];
However, above error gives me this:
com.facebook.sdk:HTTPStatusCode=403, com.facebook.sdk:ParsedJSONResponseKey={
body = {
error = {
code = 200;
message = "(#200) Permissions error";
type = OAuthException;
};
};
The problem with Facebook SDK is that there is so much documentation and almost no support that I haven't got my previous questions answered too (where I was trying to share without permission), and this problem simply doesn't yield.
Somebody please tell - Is having FB app approved by Facebook a REQUIREMENT for this to work perfectly? If so, how does one correctly provide app store ID when the app isn't even live on Apple store? They use it even in code for applinks related permissions (see above).
The crux of the issue is that everything works with developer facebook login perfectly but fails with another FB user. This means that all my plist and everything is OK. However the FB app isn't submitted (and for many valid reasons such as my iOS app is still in development - how can one be expected to submit screenshots and all even before app is live?)
Someone please help...
OK, I figured it out myself - like many other developers.
1 - This error is due to the fact that FB app isn't approved for certain permissions but still trying to use / request that permission from user. publish_action is one such permission.
2 - In order to test this, facebook app developer needs to approve test users from within develolper.facebook.com portal.
3 - This test user is located in your FB app portal under:
a) Status & Review -> Items under Review section
and
b) Roles section.
You (FB app administrator Developer) need to add the user in b), and not a).
Then the user needs to approve your request. And in order to do that, he needs to register himself as FB developer too.
So much for neat documentation...one can easily get lost.
The github samples and all are great, but none of them tells the whole picture.
Alas, they modify their error descriptions instead.
I have been getting the infamous com.facebook.sdk error 2 for some users when trying to login to an app I'm working on.
This error doesn't happen to everyone, only to certain (and what
seems to be unrelated users).
The app is switched off in their (users who are getting the error) settings->facebook, but switching it ON
doesn't solve the problem and the com.facebook.sdk error 2 is still
persistent, not allowing login.
The solution is (as mentioned in some
other posts), to go to settings->Facebook-> Delete account.
This is all the code i have for the FBLoginView
FBLoginView *loginView = [[FBLoginView alloc] init];
loginView.readPermissions = #[#"public_profile", #"user_friends",#"email"];
loginView.center = CGPointMake(self.view.center.x, self.view.frame.size.height-80);
loginView.delegate = self;
When I don't ask for those permission (don't set readPermissions), the login works fine for users that were experiencing errors, but this prohibits users taking advantage of features of the FB framework. From my understanding, these are the 3 basis permissions and should work for everyone without having my app submitted to the FB AppCenter.
My app is live (out of sandbox mode), bundle name, appID match in my project. Any idea to what I'm doing wrong, thing I should check to solve this? I have tried almost everything and am feeling quite hopeless already. Thanks for any help and suggestions!
What seemed to cause the problem was the permission public_profile. Once I removed it, it worked fine. Not sure if this has something to do with the sdk version...but apparently it does. Gluck!
I have a problem with App Center Review. I have an iOS application which has the Single Sign-On implemented (I just tested it on both types of devices). Still, when I submit my app's page for App Center Review I always get the same message (see screenshot below).
I don't know what to do anymore. It has been like this for at least few months now. I checked everything in my application, even was able to post an update in the meantime, and the page still get's rejected. The message is always the same so I don't get any more info about the error (which in my opinion does not exists).
What should I do with this issue? Who can I contact directly about it (via email preferably)?
Edit #1: In my opinion I am using the native login screen. I am 100% sure that I use official FB API (downloaded from FB page). When I connect with FB in my application the screen that pops up is a screen from FB application (see below).
Edit #2: Okay, so I've implemented new way of logging in with FB but still native login view is not presented. Instead, the login screen of FB application opens up, which is exactly the same behaviour as before... I have the FacebookDisplayName set in the .plist file.
[FBSettings setDefaultAppID:#"some_facebook_app_id"];
[FBSettings setDefaultUrlSchemeSuffix:#"some_suffix"];
[FBSession openActiveSessionWithReadPermissions:#[#"basic_info"] allowLoginUI:TRUE completionHandler:^(FBSession *session, FBSessionState state, NSError *error) {
// handler logic goes here
}];
Edit #3: yeap, the new API was the solution. Thanks!
I've been trying to make phonegap-plugin-facebook-connect cordova plugin Simple example work, and i've experienced a weired problem.
First I had the Facebook iOS application on my iphone:
On my test application based on the Simple example, when i click the Login button, it just switches to the Facebook iOS app, and switches back to my application.
Clicking the "Me" button gives me an error "an active access token must be used to query information about the current user" which means the login was not successful
Then I removed the Facebook iOS application from my iPhone:
It worked. It opens Safari with Facebook authorisation page, when i click OK it switches back to my application and the auth.login events are successfully fired.
Is this a known issue ? Is there a way to fix it ?
Thank you
I found a workaround:
in Facebook.m
- (void)authorize:(NSArray *)permissions {
self.permissions = permissions;
[self authorizeWithFBAppAuth: NO safariAuth:YES]; //Use Safari Auth instead of FB App
}
With this workaround Facebook iOS authorization will not be used, wheter installed or not.
Github issue#25
I have an iOS app that uses the Facebook SDK for authorization. The existing app does not ask for manage_actions permission. I'm using fairly standard code to start the login flow:
NSArray permissions = [NSArray arrayWithObjects: #"email", #"publish_stream", #"user_education_history", #"rsvp_event",#"user_events,user_interests", nil];
[self.model.facebook authorize:permissions];
When I enable the enhanced auth dialog in the FBDev App and then try to sign into my app, I see a new mobile auth dialog prompting me to Add to Timeline. However, clicking the button on this screen does nothing. It doesn't show an error and doesn't return to my app.
Are there any known issues or workarounds for this flow using the new auth dialog?
(Saw this on an iPad with iOS 4.3)
Thanks,
Edit: One more detail, I saw this using the Facebook app for sign in, I haven't tried it using Safari.
This may have been caused because I didn't have the Bundle ID set through the DevApp.
After setting the iOS Bundle ID in the Settings -> Basic -> Native iOS App section of the DevApp, I have stopped being blocked by the Enhanced Auth Dialog.
In Facebook.m you have this method: - (void)authorizeWithFBAppAuth:(BOOL)tryFBAppAuth safariAuth:(BOOL)trySafariAuth. You can try setting both tryFBAuth and trySafariAuth to NO at the beginning of the method.