I'm using Facebook iOS SDK 3.5 to log-in into my app, the following method is invoked:
FBSession openActiveSessionWithReadPermissions
If native iOS login is not enabled and facebook iOS app is installed, the login process will get redirected to the facebook app. The problem is that every single time 'FBSession openActiveSessionWithReadPermissions'is invoked, the facebook app presents the permission dialog to the user, even when the user already authorized the FB app.
The permission list is empty (nil). This problem does not happen if native ios or safari are used to log -in.
Any ideas? Thanks
You can check if the user has successfully logged in by checking for an access token here
Also, you can make sure you aren't popping up a GUI from each call by setting allowLoginUI to false.
+ (BOOL)openActiveSessionWithAllowLoginUI:(BOOL)allowLoginUI;
I've not done any iOS FB stuff myself, but that's what I got from reading the docs.
Also, there seems to be a somewhat related question posted here.
Related
I have an Unity application using Facebook SDK for user to link their account. Everything works in Android. But in iOS, the login page keep redirecting to the previous page which asking me to login even I press "Continue".
https://youtu.be/nGs8jiaI24s
I have found that there is a post asking the same question. But the solution does not work for me.
Unity Facebook SDK is keeping on asking me to confirm login every time I login to my game
In my case, FB.IsLoggedIn return false so loginWithReadPermission is still being called and user fall in the loop between login and continue.
Are there any method to solve it, or at least get the error message?
I am using google plus iOS sdk for login in my app. When ever i logged out from g+ and try to login again it shows permission screen (both in G+ app and browser). I cannot use trysilentauthentication because my app supports login via facebook too. How can i configure my app requesting this only once?
trySilentAuthentication is the correct answer there. If you are concerned about not giving the user the option to add Facebook to their existing Google sign in on your app, then set a flag with the result of trySilentAuthentication, and if that flag is Yes then don't immediately process the response to the finishedWithAuth:error - only do that on button press.
I'm using the latest Facebook iOS SDK, 3.1.1. I want to give users the option to "disconnect" our app from Facebook. I'm calling:
[[FBSession activeSession] closeAndClearTokenInformation];
That seems to work fine, but the next time I call
[FBSession openActiveSessionWithReadPermissions:allowLoginUI:completionHandler:handler];
it immediately gives me a token, without asking the user to login again. I would expect it to ask the user again to authenticate. If there's no Facebook account set up on the device, it works fine, because it opens the web browser where it tells the user they've already authenticated the app and shows the 'Okay' button. But if it is set up, it just silently gets the token again and so the user's "disconnecting" the app has no effect.
Is anyone else having this issue, and how are you handling it?
It doesn't ask again because the iOS SDK has given the Facebook SDK a valid access token. This is just how Apple designed their Facebook (and Twitter) frameworks. There's nothing you can do about it. Personally I think it's great. The user should only have to tell their phone once that they accept an app.
Also note that the cached token may have expired. The Facebook SDK at present doesn't fully handle the case where the iOS SDK gives it an expired token.
If you want to test then you can delete the Facebook account on your device and re-add it. That should clear the cached token.
Using:
- (void)openWithBehavior:(FBSessionLoginBehavior)behavior completionHandler:(FBSessionStateHandler)handler;
with FBSessionLoginBehaviorForcingWebView as the behaviour solved my problem. It opens the login modal box and forgets the user cookies.
I have used latest FB SKD in my iOS app so users can use facebook account to login. Application open the FB app and comes back to my app perfectly fine. However, in some place in the app, i have to show/pull some people facebook page (safari based using WebView), but even user already used the Facebook account to login into my native ios app, but the page still ask user to login again and when they click login, it shows them the annoying FB username/pass page.
Is there anyway, that the FB safari based page can authenticate the user since it's already logged into my app using FB integration? do i have to include query or something. Please give me details how to solve this problem since i'm new in this..
thanks again for your help...
pic: https://www.dropbox.com/s/rjlptu7ufpcq3vl/fb.png
When the user switches to Facebook app to authenticate, it doesn't create a cookie for your UIWebView which is why it's asking to login again. Have the user authenticate inside the UIWebView without switching to the Facebook app.
What you're talking about also sounds like a similar thing that happens with Facebook dialogs not knowing about the current Facebook session.
If you authenticate your user via Facebook, try saying the Facebook object itself as an instance variable somewhere in memory so you can access it again (a property on a singleton controller, perhaps?).
Spawning dialogs from an authenticated Facebook object appears to let them use the dialog without reauthenticating iff you have a [FBSession activeSession]. So you'd also have to maintain an active FB session. But I'm not sure if this kind of solution will work since you didn't show specific code for how you're doing your web-based FB fetches.
This question might also prove helpful:
Implement Login with Facebook in iOS 5 and 6
I'm updating my app to use the Facebook SDK(3.1) and using [FBSession openActiveSessionWithReadPermissions: allowLoginUI: completionHandler:] for authentication.
Authentication works fine like the following:
Open my app and log in, which uses Facebook SSO.
Redirected to the Facebook app.
Redirected back to my app after authentication, and my app can get
an access token and
necessary information as expected. -
But I have a problem after authentication.
The problem occurs as follows:
Close my app after authentication is done.
Open the Facebook app.
The Facebook app shows a blank view with the cancel button on the navigation bar -
The cancel button does not work.
When I scroll down the blank view, the Facebook app redirects to my app.
Here is one way to reproduce the problem:
Install my app and log in, which uses Facebook SSO.
Log out of my app.
Kill the processes of Facebook app and my app running in the background.
Open my app and log in again.
I tested it with the latest Facebook app and the previous one both on iOS5 and iOS6,
and was able to reproduce the problem with all combinations.
I want to solve this issue, but don't know where the problem is.
Is it a bug in the Facebook SDK or the Facebook app, or any problem in my app?
Thanks.