SFAuthenticationSession isn't sharing cookies on the real devices - single-sign-on

I'm using AppAuth-iOS for SSO. Everything works just fine on the ios 11 simulators and SSO (cookies sharing) doesn't work on the real devices running 11.0.0, 11.0.1, 11.0.2. So is the SFAuthenticationSession broken and is there any known workaround?

I am also facing the same issue and based on my tests and research, yes it is broken. SFAuthenticationSessions remember the cookies on a single application run, but not after the application has restarted or between multiple apps (= SSO). I have done a series of tests with iOS 11.1 beta 1 and Xcode 9.1 beta 1 with following results:
Using the SFAuthenticationSession to do an initial login, and during the same application run, using another SFAuthenticationSession to check if login is still valid (based on cookies). This works OK.
Restarting the application and then trying to check the session state will not work, indicating that the cookies are not persisted.
Using the system Safari (with UIApplication.shared.openURL) to do the login and using SFAuthenticationSession afterwards to check the login state. This also does not work. Cookies are not shared between Safari and SFAuthenticationSession.
Used the system Safari both both login and session checking works, even between multiple application runs. As expected, Safari still remembers its own cookies. But they are not shared.
The other complaint I have with SFAuthenticationSession is that is uses the project target name and not the application name for its popup dialog.
The only ongoing discussion I could find about this is in this Twitter post: https://twitter.com/rmondello/status/887434621989789696. I have also filed a bug report but no updates on it since September 5th.

Related

MSAL Sign In with JIT Migration Fails on Android Only Using Xamarin Forms

I am using Xamarin Forms in Visual Studio 2015 with the new MSAL preview v.1.1.0. The app calls the PublicClientApplication.AcquireTokenAsync which pulls up the login form in Chrome on the mobile device.
This makes my question similar to this question: New preview for MSAL login redirect for Xamarin droid fails.
There are two differences. First I am intermittently getting a different error. See the highlighted difference: "This site can't be reached. The webpage at msal[my app id]://auth/?state=..."
Second, my signin is calling a WebApi, which migrates a user from a SQL database to Azure B2C Active Directory. I am following the example below for this part: https://github.com/Azure-Samples/active-directory-b2c-advanced-policies/tree/master/Migration-JIT-sample.
I noticed that this usually happens when a user is migrated from my database to Azure B2C. In this case the signin is getting called twice. Once to migrate the user and then another time to sign the user in. The error also appeared to be happening intermittently when the user was not migrated, usually if I had not tried to sign in for a few hours, which may have been a different bug. Otherwise, the signin works fine. Also, this error does not occur on iOS. It is an Android only bug.
I think the intent listener on Android is not working correctly. When I get the ""This site can't be reached..." error, if I open the site in Chrome from my Android application, I am re-directed to my application and signed in. This makes me think the link is correct, but the listener is not working.
I am guessing this may be a bug in the line of code below, which is in the OnActivityResult method of the MainActivity. AuthenticationContinuationHelper.SetAuthenticationContinuationEventArgs(requestCode, resultCode, data);
I think I figured out a solution. I had been signing in as multiple users and the issue had been happening intermittently outside of the JIT migration, but consistently during the JIT migration. On other forums I noticed that people had user caching issues. So, right before signing in I made sure to remove all of the users from the cache.
foreach (var user in App.PCA.Users)
{
App.PCA.Remove(user);
}
PCA is an instance of PublicClientApplication. I haven't seen any "This site can't be reached." issues since then.

Facebook test app stopped working, production app works fine (using JS SDK)

I have a FB app that my website uses for the FB Login button. This app has been public for some time, and works great in production. I created a test app for my dev environments, and this too has been working fine until last week, when I suddenly started seeing this message in the browser console:
Application Error: There was a problem getting data for the application you requested. The application may not be valid, or there may be a temporary glitch. Please try again later.
This happens after I call FB.init() -- a call to FB.getLoginStatus() triggers this error, and the callback passed to FB.getLoginStatus() is never invoked. Again, this only happens in my development environments, not production, although the XFBML button still triggers a popup.
I copied the basic SDK code from FB's documentation, placed it in its own page, and still have this problem, so it is not something on my website's pages that is interfering.
I've tried searching SO/Google for answers, but the only real information I get is from back in 2011/12/13 and involved FB apps being in development mode; mine is not, it is public. I've tried creating a new test app and changing the FB ID that my website uses, but I get the same result.
The only change to (all) of my environments made recently is that they're all using SSL by default. Could this possibly be the cause? And if so, why would it work in my production environment but not in my development environments? Any insight is much appreciated.
EDIT: Using SDK v2.4, if that matters.
EDIT 2: This only seems to happen if the user is not logged into FB at all. If they have logged in externally, the SDK seems to recognize that and the call to FB.getLoginStatus() works fine.
Looks like it's a Facebook bug: https://developers.facebook.com/bugs/252572561775079/
Check that your Facebook app is "live and available to all users" and not in development mode, otherwise you'll get this error.
Go to https://developers.facebook.com/apps/ > open your app > App Review > "Make [App Name] public?" > YES

Facebook Single Sign On - Stopped opening application with no explanation

I integrated Facebook SSO in my Windows Phone 8 app yesterday and it was working properly. I tested it several times and on multiple devices and all was working. I submitted the code to my repository and today when I ran the code on the device the SSO wasn't working properly.
It starts off by starting the Facebook App as usual but then it shows me the dialog that it usually shows in the browser (with the typical message asking if I don't wish to install the Facebook application on my phone, which is installed) and even if I sign on it doesn't go back to my app.
I have not changed a single line of code since yesterday so I really have no idea of what must be happening. I checked if the Facebook App had been updated but it wasn't.
Does anyone have any idea of what might be happening?
It was an issue with the Facebook app which they seem to have resolved by today. Now everything is working properly again.

FB.init() callback stopped been called

I know that there are similar question, but I think that my situation might be different.
I have two facebook applications. One is for develop - it works in sandbox mode and works with localhost. The other one is for production, with the sandbox mode off and an active ssl.
I haven't used develop app for some time, and now I've found that FB.init() is not called anymore. However, in Google Chrome browser everything works fine, and production server works in all browsers. What can be the reason of this problem? Did Facebook got some king of update or something like that? Maybe it stopped to work because develop app needs SSL too?
Took me some time, but I figured it out. Now to use your develop non ssl applications on facebook, first you have to go into Security tab in facebook account settings and set Secure Browsing to disabled.
What I can't understand, why I haven't got any notification from facebook about this issue? If there was some kind of notification, then it was too hidden.

SSO login dialog returns to fbDidNotLogin with no indication of error

I have recently created a new Facebook app ID as I'm adding Facebook SSO integration into my app. My app within Facebook is set to Native iOS and I've included the Bundle ID and a current published app's Apple ID (for testing).
I've implemented the SDK as per the instructions (I have two other iOS apps currently using the SDK without issue as well). All delegate methods and required plist entries are in place for the URL callbacks.
After attempting a login I'm shown the Facebook white screen (just a loading spinner) with blue bar but after 5 seconds it redirects back to my app and hits the fbDidNotLogin delegate method. That method doesn't include any sort of retrievable error (at least none that is documented or available to me).
So at this point I'm at a loss for what might be causing my login to fail. Is there any way to get a more detailed error? Or has anybody else run into this same problem?
I had the same issue. Solved this by changing two items in the Facebook app settings:
Configured for iOS SSO set to enabled
Updated the iOS Bundle ID so that it matched by bundle ID exactly (previously the casing was different)
Not sure which item fixed it, I largely suspect the first...but worth checking both.
Make sure your device's time and date settings are correct. I had this happen to me when I recharged and turned on an iPod whose battery had died. The date and time were totally wrong, and when I set them to what they were supposed to be, I got the Facebook login dialog just fine.