Cordova In App Browser (with Ionic Native Import) opens no windows in iOS

Hi guys,

currently, I’m working on an auth-workflow, which is based on js (Login with XING – documentation | XING Developer ). Note I explain the problem in detail at first in the context of Xing, however, the problems with in app browser should be general. I managed to implement it in my ionic / capacitor application and in a browser it is working fine. However, I must build a native application, and at this point, I face several problems (if you have any gues or help, please let me know :slight_smile: ):

  1. When I run the ionic app on a device (either emulator or local) and click the Xing-auth-button as like in the browser, I face a problem with the redirection URL. This redirect-URL is automatically created by the script (extracting the URL worked but was not helpful at this point…). Yet, the redirect-URL does not point to the app, as the app runs in localhost and the Xing-server obviously is not knowing my app-localhost. Due to this challenge, I set up a little website for handling the auth process. → 2.

  2. On the website I implemented the scripts (from Xing) and implemented to open the website from my ionic app. In the browser, it works fine again. I use let newWindow = window.open() and can communicate with the opened window with addEventListener(s) and postMessage. Facing an iOS emulator there is a problem. On the iOS emulator the window.open(…) does not return a value, thus newWindow is null. Further the “noopener”-restriction leads to the problem that the opened window has no information about it’s source (this is the reason why I switched to the reference method from window.open). As there is no source information available and I can’t communicate with the window, due to the null response, I finally switched to the cordova in app browser → 3.

  3. The implementation of the in app browser is realized with ionic native and works fine on android.

...
browser: InAppBrowserObject;
constructor(private plt: Platform, private iab: InAppBrowser) { }
...
openIAB() {
    this.browser = this.iab.create(url, '_blank', "location=yes,clearsessioncache=yes,clearcache=yes")
    this.browser.on('loadstart').subscribe((e: InAppBrowserEvent) => {
      console.log('load start', e)
      if(e.url==...) {
           ... // here I retrieve the auth-data
      } else {...}   
    })
}

If I open the iab in android, I can click the button, sign in, are redirect to the website and finally get the auth-data. In iOS I face the problem, that if I click the sign-in-button, it seems as the iab is restricted to open a new window (So I can open the auth-website, where I implemented the button, but if I click the button on the website nothing opens). Also checked this with other links.

So finally the question: Have some of you maybe faced a similar problem and have gues how to overcome any of these problems?! Thank you so much in advance :slight_smile: