InAppBrowser eventlisteners

Hello,
I am using InAppBrowser to open Office 365 login page,where user logs in and redirects back to app. Now when redirecting back to application, I am fetching some data from the callback url, and this data is passed to local web service which gives access to app main page. I am using loadstop eventListener where I fetch the data from url, and exit event to call the local web service. Now the issue is, the data I am getting in loadstop event is not able to access in the exit event. Below is my code. What could be the problem

public office365Login(){ 
  debugger;

 let browser = new InAppBrowser("https://login.microsoftonline.com/" +SvcConstsService.TENANT_ID+ 
            "/oauth2/authorize?response_type=code&client_id=" + SvcConstsService.CLIENT_ID +
            "&resource=" + SvcConstsService.GRAPH_RESOURCE +
            "&redirect_uri=" + SvcConstsService.REDIRECT_URL,'_blank','location=no');

            browser.on("loadstop").subscribe(function(event){

                 this.code_token=event.url.split('?')[1].split('&')[0].replace('code=','');
                 this.session_state=event.url.split('&')[1].replace('session_state=','');
                 console.log("code_token ",this.code_token);
                 console.log("session state ",this.session_state);
                 browser.close();
     
            },err=>console.log(err)
            );

     
            browser.on("exit").subscribe(()=>{
               // the above code_token and session_state data is not able to access here, as this data has to pass to 
                  getUserDetails() method
               console.log("code_token  " +this.code_token + "session_state  " + this.session_state);
               this.getUserDetails(this.code_token,this.session_state); 
            });
}
getUserDetails() {
     debugger;
     
      this.url="mainpage/email";
      let body="code="+this.code_token+"&sessionState="+this.session_state;
      this.httpSer.performLoginPOST(this.url,body).subscribe(
          response => {
            if(response!=""){
              if (response.success) {
                // this.loadingPopup.dismiss();
                
                 this.nav.setRoot(MainPage);
                 this.storage.set('userData', {
                 userName: response.userName,
                 userId: response.userId,
                 roleId: response.roleId,
                 roleName: response.roleName,
                 action: response.action,
            });
          }
        }else{
                // this.loadingPopup.dismiss();
                this.showToast(response.message);
                
            }
          }, error => {
        })
  }