FBSDK Login - SFSafariViewController is disabled? - ios

I've had an issue on my app overnight that I thought was a coding bug. The issue is that the SFSafariViewController login window (Safari based) - is no longer being presented. Instead, it is launching a new Safari app, and once I log in, I now get the native iOS dialog "Open his page in "XXXXXApp"? I didn't change any settings, didn't play with anything at all. After downloading the source for the FSBDK iOS and debugging, it turns out that "SFSafariViewController" is being disabled by facebook explicitly.
I made a graph call, the same one that the app uses to start up to this endpoint:
https://graph.facebook.com/v2.7/<app-id>?fields=app_events_feature_bitmask%2Cname%2Cdefault_share_mode%2Cios_dialog_configs%2Cios_sdk_dialog_flows.os_version%289.3.0%29%2Cios_sdk_error_categories%2Csupports_implicit_sdk_logging%2Cgdpv4_nux_enabled%2Cgdpv4_nux_content%2Cios_supports_native_proxy_auth_flow%2Cios_supports_system_auth%2Capp_events_session_timeout&format=json&include_headers=false&sdk=ios
And the response appears to disable the controller SFSafariViewController. The evidence in this portion of the payload:
"ios_sdk_dialog_flows": {
"default": {
"use_native_flow": true,
"use_safari_vc": false
}
}
Previously, the use_safari_vc value was set to true. In anyone answers, please keep in mind I want to use the Safari View Controller - but not launching safari as it falls back to now. The latest behaviour asks to open my app, which I thought the Safari View Controller was meant to solve! Also keep in mind that everything was functioning well until this morning. I've tried recreating my app multiple times, but the same behaviour still persists.
Help, my user experience with Facebook is now terrible (and note, I don't care about using native behaviour - I just want Safari View Controller again!)
I'm using v4.15.0 of the Facebook SDK
Cheers

I got word from Facebook developers group that it was an issue on the server side, and that change has been reverted.

Related

Change the display of Safari with ReactNativeKeycloak in-app browser options

I am trying to change the display of the following login with keycloak page.
https://imgur.com/a/X18bmgC
This shows up with Safari when starting the app.
The problem I have is that the user has to scroll to see the " New user " part of my WebView. And this is a problem.
I'd like to change the display of my WebView to make it look like this if possible :
https://imgur.com/a/DYfpkRS
Here I had to manually unzoom the page.
<ReactNativeKeycloakProvider
authClient={keycloak}
onEvent={onEvent}
initOptions={{
redirectUri: 'mobile://presentation',
inAppBrowserOptions: {
ephemeralWebSession: true,
modalEnabled: true,
},
}}>
This is the code displaying the Keycloak Login page in Safari ( https://github.com/react-keycloak/react-native-keycloak ).
I've checked the different InAppBrowser options here : https://github.com/proyecto26/react-native-inappbrowser#ios-options
When changing the values of each of these options, I can see no differences on the iPhone I'm using. When I change 'ephemeralWebSession' from true to false, I can see the difference. But every other option makes no difference for me. I tried to change 'modalTransitionStyle', 'modalPresentationStyle', 'readerMode' and 'preferredBarTintColor' values, but nothing shows different on the WebView.
I don't understand what I should change to get my WebView to change aswell.
I realize this is about 6 months old as I'm writing this answer, but I had this same issue and came across this in a search.
There is an open issue with InAppBrowser that addresses this: https://github.com/proyecto26/react-native-inappbrowser/issues/292
In short, RN Keycloak calls the InAppBrowser openAuth method to start an ASWebAuthenticationSession instead of a typical web session with the open method. ASWebAuthenticationSession is not customizable, per Apple.
So, the choice is to modify the RN Keycloak package to use the open method, or to do some overriding trickery with Objective-C as found here: https://msolarana.netlify.app/2021/01/06/fixing-aswebauthenticationsession-presentation/

Firebase Deeplink not redirecting to app if select goo.gl

I'm integrating firebase in application. I created universal link that worked for Android & iOS both.
This worked great. BUT I got scenario where I clicked on goo.gl (PFA) link which was displaying on launched app right-top side. And from then no matter what I do, Deeplink will never launch my application.
I checked to clear history of device-browser but it's same. Any suggestion how to get rid of this issue/feature ??
You're absolutely right: the forward button is horrible UI/UX. It's one of the big flaws with Universal Links identified in this blog post. There is no way to disable the forward button, and once it's triggered, you're screwed.
The easiest way to re-enable Universal Linking behavior after it is turned off is to long-press on the link. Your best bet at getting a clean shot is to paste the Universal Link URL into the stock Notes app and try long-pressing it from there.
Long hold on the url and there will be option to open in app.
Usually when you click the "forward" link to open the universal link in Safari, you can re-open the app by dragging the page down. A bar will appear with your app name and an "OPEN" button. This works as long as you're still in the same URL.
Unfortunately, for Firebase Dynamic Links specifically, the link will redirect you to another domain (for example, from https://z99zz.app.goo.gl/zzzz to https://z99zz-c.app.goo.gl/zzzz) and this breaks this feature. The solution is to either add ?d=1 to the original link (https://z99zz.app.goo.gl/zzzz?d=1, opens a link debug page), or just remove everything after the domain (https://z99zz.app.goo.gl/, opens an error page). Now when it opens in Safari, you can drag down and see the bar.
In addition to imgx64 post. I had a similar problem: Firebase redirected to z99zz-c.app.goo.gl/zzzz and in this case system was not redirected to my app. I added "applinks:mzn3g-c.app.goo.gl" as Associated domain in my target capabilities and this does the trick! Even if you redirected to domain with "-c" suffix iOS can recognize it and will redirect to your app and show suggestion in Safari

ios app open safari in background

I have an app that logs you in via opening safari and redirecting you back to the app - however on "Log out" I need to open safari in order to log you out - is there a way to do this in the background instead?
For Log in:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[DataService loginURL]]];
However, I would like to not have to do the same for Logout - and simply get safari to run in the background or something similar. The problem is that the cookies are saved, and I need to get rid of them. Can I get safari to open a website without having to open Safari through the application?
Can you open Safari in the background? I'm pretty certain that the answer to that is no. In any case, if your main concern is to delete the cookies then you may not get the chance - the user could just kill the app, and the cookies would sit in Safari.
Is it an option to use a UIWebView or WKWebView to perform authentication? So rather than taking them off to Safari, the user would see the browser content actually inside the app.
That might improve the user experience, and you'd get a lot more control. For example, you could point the web view to your log out url when the time came for it. That might save you some cookie hassles too.
Besides which, I think openURL: is now deprecated because it was involved in some shenanigans.

Close in app browser after a redirect

We have an ad partner that is redirecting users to the app store after an ad in our app is tapped. We load an in-app browser which does the redirect. Nothing in the browser ever loads, it is just a white screen. Once the user returns to our app they are looking at that empty browser. Is there anyway to dismiss or close that browser once the redirect is completed?
We don't have any control over the server side.
What kind of in-app browser you are using in your app? Like a library or an UIWebView? If it's an UIWebView, there's a callback method when the webpage is loaded (and probably, redirected the link):
- (void)webViewDidFinishLoad:(UIWebView *)webView;
If you're using a library, I'm pretty sure it also has a method like that.
I fixed this by skipping the in-app browser and used Safari instead. App store re-directs are happening without showing the browser window and all the other ads are working as expected.
Plus I got to delete a bunch of old code.

Options for presenting website when website/app supports Universal Links in iOS 9

In iOS 9 I can register my website (FooSite) to link to my app via Universal Link. Now let's say a user in another app (BarApp) encounters an HTTP link to my app (FooApp).
Does BarApp have the option to present FooSite instead of allowing iOS to resolve the universal link and launch FooApp?
Do the options change between UIWebView, WKWebView and Safari View Controller?
To answer your first question, BarApp should not. I haven't tried to prevent this, but I can't see how, short of not firing the URI at all, BarApp could launch FooSite rather than FooApp.
To answer your second question, SFSafariViewController is extremely limited in what the developer is allowed to access. You can set an initial URL, know when the initial URL loads, and know when the user has tapped the dismiss button. That's it. No inspecting the current URL, no intervening in requests, etc.

Resources