I m trying to get the dropbox token. After successfully login, dropbox redirects the url and Inappbrowser goes directly to "about:blank" in the background. I believe token comes for a second but inappbrowser redirects the browser so fast to "about:blank" so the token is lost. I found out when i put a breakpoint in the event listener i can get the token actually. It is really weird. What am i doing wrong ?
connectDropbox() {
this.$rootScope.$on('$cordovaInAppBrowser:loadstart', (e, event) => {
if(event.url.indexOf("access_token") > -1){ // when i put here breakpoint i actuall get the token, otherweise not.
this.TOKEN = this.parseQueryString(event.url).access_token;
this.uploadXml();
}
});
let dbx = new Dropbox({clientId: this.CLIENT_ID});
let str = dbx.getAuthenticationUrl("http://localhost");
this.$cordovaInAppBrowser.open(str, '_blank', this.defaultOptions);
}
My Options for Inappbrowser :
private defaultOptions = {
location: 'no',
clearcache: 'no',
toolbar: 'no'
};