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.
Related
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. :)
I want to log the user into my app with Facebook using (in this order) these methods:
The account stored in settings (via the Accounts Framework)
Switching to the Facebook App
Displaying my own UIWebView inside the app (and sending the requests
manually)
If one method doesn't work, I want to fallback to the next.
The problem I'm having is that
[self.fbsession openWithBehavior:FBSessionLoginBehaviorForcingWebView
completionHandler:
opens Safari or shows a popup that I can't customise.
I absolutely need to follow this order because I use a webview for other social networks (ie Twitter, LinkedIn and GooglePlus).
Is there any way to manually open the Facebook App for the Oauth flow ?
To manually check if the Facebook app is installed you can use:
[[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:#"fb://requests"]]
We are using the legacy headers from the Facebook iOS SDK (3.1.1), as we don't want the user to be able to leave the app. This is a particular issue for us, as we are using GameKit and iOS kills the connection rather quickly after leaving the app (a few seconds is enough)
What I am doing right now, to show the login dialog is:
m_facebook = [[Facebook alloc] initWithAppId:m_fbAppId andDelegate:self];
NSArray * permissions = [NSArray arrayWithObjects:#"publish_stream",nil];
[m_facebook authorize:permissions];
However the dialog doesn't have a cancel button, so the user has no way of leaving it, except with a successful login. Is there a fix?
Best,
Gorm
If you use an older version of the Facebook SDK, the 'X' button will not appear at the top-left of the authorization dialog. Updating to the latest SDK solved the issue for me.
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'm currently working on an iOS app, and I use apprequests to bring up the dialog to send request. I can see everything working fine (I got the dialog complete thing) but user is not getting the request! I'm working with a test FB app (not public), I'm thinking if there's something I'm missing on setting up the FB app? Or is there a specify permission I have to enable?
Here is a little piece of my code:
-(void)appRequestsWithMessage:(NSString )message {
NSMutableDictionary params = [NSMutableDictionary dictionaryWithObjectsAndKeys: message, #"message", nil];
[facebook dialog:#"apprequests"
andParams:params
andDelegate:self];
}
To allow App Requests to be shown in Facebook, you have to enable "App on Facebook" in Apps Settings and supply a "Canvas URL" and a "Secured Canvas URL".
Have you added the receiving user as a tester on your Facebook app admin page? As long as you're in sandbox mode, only users added as testers (or any other position) can see, interact with and receive requests from our app.
Check the settings page for your app.