Skip to content

Commit

Permalink
Issue #SB-8909 feat: Fixed logout issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
AmiableAnil committed Dec 27, 2018
1 parent 9eba3e8 commit c15f0cf
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions src/services/auth/oauth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ export class OAuthService {
}

doOAuthStepOne(isRTL = false): Promise<any> {

return new Promise((resolve, reject) => {
customtabs.isAvailable(() => {
//customtabs available
Expand Down Expand Up @@ -112,8 +111,7 @@ export class OAuthService {
return new Promise(function (resolve, reject) {
if (that.isGoogleSignup(token)) {
that.createInAppSession(that.getQueryParam(token, 'refresh_token'), that.getQueryParam(token, 'access_token'), resolve, reject);
}
else {
} else {
that.authService.createSession(token, (response) => {
try {
let dataJson = JSON.parse(response);
Expand All @@ -127,7 +125,6 @@ export class OAuthService {
reject(error);
});
}

});
}

Expand Down Expand Up @@ -198,26 +195,23 @@ export class OAuthService {
}

doLogOut(): Promise<any> {

return new Promise((resolve, reject) => {
customtabs.isAvailable(() => {
customtabs.launch(this.logout_url!!, success => {
this.authService.endSession();
resolve();
}, error => {
reject();
reject(error);
});
}, error => {
let browserRef = (<any>window).cordova.InAppBrowser.open(this.logout_url);
browserRef.addEventListener("loadstart", (event) => {
if ((event.url).indexOf(this.redirect_url) === 0) {
browserRef.removeEventListener("exit", (event) => { });
browserRef.close();
this.authService.endSession();
resolve();
}
customtabs.launchInBrowser(this.logout_url!!, callbackUrl => {
this.authService.endSession();
resolve();
}, error => {
reject(error);
});
});
});
}

}
}

0 comments on commit c15f0cf

Please sign in to comment.