Facebook Login for the iOS app occurring outside of the appliaction - ios

I am using Facebook login for my iOS app .For the first time the user needs to login via Facebookand When a login is asked the app is redirecting to Safari browser or it will redirect to the Facebook app if the Facebook app is installed on your device.
But now we require the Facebook login to take place within our app.
Could this be possible.Please help to find this issue.
Thanks in advance..

please put this line :
loginButton.loginBehavior=FBSDKLoginBehaviorWeb;

use FBSDKLoginBehaviorSystemAccount as loginBehavior. App will use facebook account configured on iphone settings

Related

iOS Facebook SDK - Opening link to users profile works in Safari, but not if user has Facebook app installed on their phone

I've setup the Facebook SDK with my current iOS application in which I can login and retrieve the current user's facebookUID and other profile information.
I'm currently trying to set it up, so a user can open up another user's Facebook profile from within my app, however, I'm noticing that if the user has the Facebook app already installed on their phone, the request will open up the Facebook app and it will then result in The page your requested was not found error.
However, if the user doesn't have the Facebook app installed on their phone, it will then open up the person's profile correctly in Safari for some reason.
Any ideas what's going on?
Here's how I'm currently trying to open the person's profile:
let fbURLWeb: NSURL = NSURL(string: "https://www.facebook.com/\(facebookUID)")!
UIApplication.sharedApplication().openURL(fbURLWeb)
Also, has anyone gotten this to work in the new SDK, or could this be a bug?
Thanks in advance!

Permissions dialog in Facebook iOS native app

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.

Facebook iOS SDK and Safari based authentication issue

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

Facebook app redirects users to my app and becomes unusable once SSO is done

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.

Different Facebook Auth Dialog in Safari?

I found two different FaceBook auth dialog while using two apps one is "Poker by Zynga" and other one is I am developing.
When I use FaceBook login in "Poker by Zynga" then Safari opens this page:
And when I use my app which is under development now, then Safari opens this page:
You can see both of these are two different pages. In Poker by Zynga, it says "Logged in as Vicky Gupta - Log Out" where user can choose Log Out to sign in as a different user. While in my app it says "You are logging into this app as Vicky Gupta", in this there is no Log Out button. The only way to log in as a different user to open FaceBook in Safari and then log out from there.
Does any one know why this difference is occurring ? am i missing something in FaceBook app settings? Or is this a normal behavior because I don't think so?
Note: I am using the latest FaceBook SDK (with graph api).
If you are using latest iOS Facebook SDK, I think to logout a user you just have to delete the token obtained by the Facebook main object.

Resources