In app browser android with re-direct broken


#1

I am using cordova inappbrowser in ionic 2. I open a browser window and listen to onload:

let browser = this.iab.create(loginUrl, "_blank", "location=no,toolbarposition=top,closebuttoncaption=Cancel,clearsessioncache=yes,clearcache=yes");

browser.on("loadstart")
        .subscribe(
          (event) => {
            console.log('### load start event');
            if(event.url.substr(0, redirectUri.length) === redirectUri) {
              this.handleLoginEvent(event.url, browser);
            }
          },
          err => {
            console.log("InAppBrowser Loadstop Event Error: " + err);
          }
        );

The url in loginUrl forces a redirect for an oauth pattern. In iOS, everything works fine, but on android the page simply doesn’t load. The emulator shows the correct URL but the page itself won’t load - just a whitescreen. It will load if I simply open https://google.com.

Here is my $ ionic info:

Your system information:

Cordova CLI: 7.0.0 
Ionic Framework Version: 3.1.1
Ionic CLI Version: 2.2.3
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.3.7
ios-deploy version: 1.9.0 
ios-sim version: 4.1.1 
OS: macOS Sierra
Node Version: v6.9.4
Xcode version: Xcode 8.3.3 Build version 8E3004b

#2

Did you remote debug the problem on the device already? Follow these instructions here to debug the problem in Chrome dev tools: https://ionic.zone/debug/remote-debug-your-app#android Look at the console and network tabs for errors.