I searched in the form and checked out related topics but nothing really worked for me. I need to close the InAppBrowser when the url has the token and take the token from the url. So far i cant detect when the url changes in inAppBrowser. Any ideas what i do wrong ?
*console.log("event fired") never works :/
Controller:
openDropboxDialog() {
let str = this.DropboxService.getDropboxUrl();
this.$cordovaInAppBrowser.open(str, '_blank', this.DropboxService.getOptions());
this.$rootScope.$on('$cordovaInAppBrowser:loadstart', (e, event) => {
console.log("event fired")
if (event.url.indexOf("token") > -1) {
this.$cordovaInAppBrowser.close();
}
});
}
Service :
getDropboxUrl() {
let dbx = new Dropbox({ clientId: this.CLIENT_ID });
let str = dbx.getAuthenticationUrl("http://localhost:8100")
return str;
}