Spotify redirect_uri to app

I’m using the Authorization API provided by Spotify ( and inAppBrowser like this

    const browser = this.iab.create(''+client_id+"&response_type="+response_type+"&redirect_uri="+redirect_uri+"&state=34fFs29kd09&show_dialog=true","to _self","location=yes,toolbar=no");;

It’s work but i don’t want to redirect the user into the redirect_uri I just want to catch the code in the redirect_uri“XXXXX” and go back to the app.

Is this possible ?


Can you register any random url as callback?

const browser =
      browser.addEventListener("loadstart", (event) => {
        if ((event.url).indexOf("http://localhost/callback") === 0) {

          browser.removeEventListener("exit", (event) => {});

          // do stuff with URL
      browser.addEventListener("exit", function(evt) {
        reject("Sign in flow was canceled");

Note that this doesn’t use Ionic Native.