Ask InAppBrowser to always use _blank

Hello! I am using ionic 4 and capacitor. I am trying to use inappbrowser to open a simple google page inside the app, but when the call is made it opens my safari browser instead of a popup.

I am using @ionic-native/in-app-browser ^5.1.0
and the Cordova plugin is 3.2.0

It seems like InAppBrowser uses the system option by default, which opens up the system browser. However, I am using an rpm package for oidc and I do not have control on it unless I wrap it.

Is there a way to ask InAppBrowser to always use _blank?

I also added InAppBrowser in the providers array of the App Module.

What am I missing?

Thank you so much

How do you use it? Can you provide some Code?

Sure! I only call the oidc signing popup. I just forked the repo to check if it was using _blank by default and it seems to be using _blank.

  public startAuthentication() {
    if (this.app.isApp()) {
     this.manager.signinPopup().then((user) => {
       this.setUserInfo(user);
     }).catch((e) => {
       console.log(e);
     });
    } else {
      return this.manager.signinRedirect();
    }
  }

The above code is not mine, but I did test it on an ionic 3 app and it worked
After reading through the source of the OIDC-client plugin I found the following:

const DefaultPopupFeatures = 'location=no,toolbar=no,zoom=no';
const DefaultPopupTarget = "_blank";

export class CordovaPopupWindow {

    constructor(params) {
        this._promise = new Promise((resolve, reject) => {
            this._resolve = resolve;
            this._reject = reject;
        });

        this.features = params.popupWindowFeatures || DefaultPopupFeatures;
        this.target = params.popupWindowTarget || DefaultPopupTarget;
        
        this.redirect_uri = params.startUrl;
        Log.debug("CordovaPopupWindow.ctor: redirect_uri: " + this.redirect_uri);
    }

    _isInAppBrowserInstalled(cordovaMetadata) {
        return ["cordova-plugin-inappbrowser", "cordova-plugin-inappbrowser.inappbrowser", "org.apache.cordova.inappbrowser"].some(function (name) {
            return cordovaMetadata.hasOwnProperty(name)
        })
    }
        navigate(params) {
        if (!params || !params.url) {
            this._error("No url provided");
        } else {
            if (!window.cordova) {
                return this._error("cordova is undefined")
            }
            
            var cordovaMetadata = window.cordova.require("cordova/plugin_list").metadata;
            if (this._isInAppBrowserInstalled(cordovaMetadata) === false) {
                return this._error("InAppBrowser plugin not found")
            }
            this._popup = cordova.InAppBrowser.open(params.url, this.target, this.features);
            if (this._popup) {
                Log.debug("CordovaPopupWindow.navigate: popup successfully created");
                
                this._exitCallbackEvent = this._exitCallback.bind(this); 
                this._loadStartCallbackEvent = this._loadStartCallback.bind(this);
                
                this._popup.addEventListener("exit", this._exitCallbackEvent, false);
                this._popup.addEventListener("loadstart", this._loadStartCallbackEvent, false);
            } else {
                this._error("Error opening popup window");
            }
        }
        return this.promise;
    }

The popup target is set in the UserManagerSettings, but I was not providing an option to specify the target. I just tried to explicitly set it to _blank, but I do not think it will change anything.

UPDATE:
I just tried it and it is not working