Different Facebook Auth Dialog in Safari? - ios

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.

Related

iPhone OAuth login request redirects to App not Browser, doesn't work

My current scenario is:
Running an iPhone on the latest iOS
LinkedIn App is installed and logged in
Web browser is NOT logged into LinkedIn (because I have the app)
Developing a web app with "log in with LinkedIn" functionality
On the iPhone, clicking the "log in with LinkedIn" button redirects me straight the the LinkedIn App, which subsequently does nothing - just shows me my feed. I have verified this same behaviour occurs on a third-party site as well as my own. Note that Android exhibits similar behaviour, though I haven't tested as extensively there.
I've found several workarounds:
If I open the web site in Private Browsing mode clicking the login button asks me if I want to open the App or stay in the browser.
If I long-press and "Open in background tab" the login button it'll open (in the background, of course) instead of redirecting to the app, allowing me to log in.
If I manually type "linkedin.com" into the browser and log in then it seems to work too.
None of these are even vaguely practical for end users, essentially forcing us to remove the option entirely.
I'm fairly sure this is a problem at LinkedIn's end and the solution is either:
Don't redirect to the App for OAuth Authorize requests, or
Make the App correctly handle OAuth Authorize requests.
If I'm incorrect and there's some way we can stop this redirect from the client side I'd be happy to hear, otherwise I hope LinkedIn engineers actually see this...
See the comments in Issues with Linkedin Social connection
LinkedIn already confirmed that it is a problem on their side.

New facebook login redirect flow on iOS

As of iOS 11, I'm seeing a new login flow when using FBSDKLoginKit and FBSDKCoreKit. I realize apple's recent change(s) to how apps talk with each other re: facebook credentials mean we first have to go through safari during the authentication flow... but for some reason I'm seeing the below alert dialog (see first and second screenshots) even though in other apps that feature facebook login, I'm able to go directly to facebook.com and am then offered the choice to either authenticate through the native Facebook app or log in with email/password (see second screenshot).
Does anyone know why I'm seeing this flow on my app but am seeing a different flow on pretty much every other app that I've looked at that's implemented facebook login? I've followed the flow listed on https://developers.facebook.com/docs/facebook-login/ios so I'm pretty much stumped. Thanks in advance.
You can try changing the loginBehavior of the login manager. See https://github.com/facebook/facebook-ios-sdk/blob/master/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginManager.h#L72. That alert is part of iOS 11' SFAuthenticationSession auth flow.
/**
This is the default behavior, and indicates logging in through the native
Facebook app may be used. The SDK may still use Safari instead.
*/
case native
/**
Attempts log in through the Safari or SFSafariViewController, if available.
*/
case browser
/**
Attempts log in through the Facebook account currently signed in through
the device Settings.
#note If the account is not available to the app (either not configured by user or
as determined by the SDK) this behavior falls back to \c .native.
*/
case systemAccount
/**
Attempts log in through a modal \c UIWebView pop up
#note This behavior is only available to certain types of apps. Please check the Facebook
Platform Policy to verify your app meets the restrictions.
*/
case web
This is an intended behaviour, confirmed to me by Apple & Facebook. It's the implementation and flow of SafariViewController authentication, it's documented by Apple too (the system alert) & the third screenshot you post it's most probably an app using an old version of Facebook SDK. Please checkout this post I opened some weeks ago with the same UX you describe, then you'll find more comments & links to the proper documentation. You can not do nothing in your code to prevent the system alert to appear, unless you downgrade the FB version.

ios - multi facebook account on one device

I'm having an iOS app, need Facebook login to share something to wall. Everything is ok until I received new feedback from customer. Let me describe this case.
Apple have integrated Facebook into iOS system, user just needs to login via Setting, it is so easy for user. But my customer does not want to do that, they want user to login Facebook inside app and use it instead of Facebook of iOS system. Problem is here, there is a case: user has already logged in Facebook account A via iOS system, then user opens app and login Facebook inside app with other Facebook account B. After that, user shares a picture. Requiment is this picture should be shared on wall of Facebook account B (of app), but this picture appeared on wall of Facebook account A(of iOS system).
I just wonder do we have any solutions to resolve this case? Please give me any ideas you all have in mind after reading.
Thanks,
Ryan
I faced the same problem with Facebook SDK whenever a user login from any app using Facebook it change userid returned with the token which leads to share on the latest opened account.
if you open Facebook from a browser you will get this message from Facebook " we got confused please re-login "
so i took the same approach i saved user-id User(A) and whenever user share i check id coming with token if it changed i show " Facebook account changed please relogin " & i log all users out.
check this link may be helpful: https://www.facebook.com/help/community/question/?id=10205949056147843

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

IOS: Registering new app on Facebook

There must be an easy answer to this one....
I am trying to integrate my latest IOS App to Facebook. I have not used Facebook before, so just set up a "company" page with basic information on my firm.
I'm following all the Facebook links i.e. https://developers.facebook.com/docs/mobile/ios/build/
But I cannot get beyond Step 1 (LOL). Whenever I click the link "Step 1: Registering your iOS App with Facebook," it keeps taking me to my company's Facebook Admin screen!? I cannot find a way to register my App off this screen. Where is the "Add new app" link??
I'm going in circles. Help appreciated.
It's not possible to register an App under a Business account, and you have to create (or lend) a personal account. And keep in mind: Facebook frowns upon incorrect information, so should be a legit person or your account will be suspended when (not if) they find out.
Secondly you have to authorize your Facebook account. For example: by entering mobile phone no. and entering code from a text FB will send you (more info: http://www.facebook.com/confirmphone.php) or entering CC information (more info: https://secure.facebook.com/cards.php)
When you (finally) have an authenticated account:
https://developers.facebook.com/apps Is the location you should be looking at.
Over at http://developers.facebook.com/docs/opengraph/tutorial/ Step 1 describes the creation of a Facebook App. (rather simple, by clicking on "Create New App")
Hope this helps! Good luck!
I believe the problem is that you are attempting to create a Facebook App with your "page user". IE you clicked "Use Facebook as..." and clicked on one of your pages.
You can not create an application in this way. Applications must be created by "real" users. You're going to want to follow that tutorial you posted to and use your user.
If you are hesitant to use your own account, ask your boss to use his or request from your clients login credentials to open the application on their account.
The reason behind this is so that Facebook can track "bad" applications back to real people, people who had to verify their account by submitting a mobile phone or credit card number.

Resources