0

I am facing issue with how to fetch updated user profile information. Right now in chrome Inspect : Application Session storage is showing both information, old first name, last name and after edit profile updated first name, last name. My below script is fetching old info - first name and last name.

Which event i have to use to get latest payload?

I have try below event but not able to fetch.

// SSO_SILENT_SUCCESS

// ACQUIRE_TOKEN_SUCCESS

//HANDLE_REDIRECT_START

// SSO_SILENT_START

//ACQUIRE_TOKEN_START

// ACQUIRE_TOKEN_NETWORK_START

Relevant Code Snippets

this.msalBroadcastService.msalSubject$
  .subscribe((result: EventMessage) => {
    console.log(result);
    console.warn("Home component. LOgin Success");        
    const payload = result.payload as AuthenticationResult;

    localStorage.setItem('IdToken', payload.idToken);
    this.authService.instance.setActiveAccount(payload.account);
  });

  this.msalBroadcastService.msalSubject$
  .pipe(
    filter((msg: EventMessage) => msg.eventType === EventType.SSO_SILENT_SUCCESS)
  )
  .subscribe((result: EventMessage) => {
    console.warn("notification. SSO_SILENT_SUCCESS");        
  });

  this.msalBroadcastService.msalSubject$
  .pipe(
    filter((msg: EventMessage) => msg.eventType === EventType.ACQUIRE_TOKEN_SUCCESS)
  )
  .subscribe((result: EventMessage) => {
    console.warn("notification. ACQUIRE_TOKEN_SUCCESS");        
  });

  this.msalBroadcastService.msalSubject$
  .pipe(
    filter((msg: EventMessage) => msg.eventType === EventType.HANDLE_REDIRECT_START)
  )
  .subscribe((result: EventMessage) => {
    console.warn("notification. HANDLE_REDIRECT_START");        
  });

  this.msalBroadcastService.msalSubject$
  .subscribe((result: EventMessage) => {
    console.warn("notification Remove Pipe");        
  });

  this.msalBroadcastService.msalSubject$
  .pipe(
    filter((msg: EventMessage) => msg.eventType === EventType.SSO_SILENT_START)
  )
  .subscribe((result: EventMessage) => {
    console.warn("notification. SSO_SILENT_START");        
  });
  this.msalBroadcastService.msalSubject$
  .pipe(
    filter((msg: EventMessage) => msg.eventType === EventType.ACQUIRE_TOKEN_START)
  )
  .subscribe((result: EventMessage) => {
    console.warn("notification. ACQUIRE_TOKEN_START");        
  });
  
  this.msalBroadcastService.msalSubject$
  .pipe(
    filter((msg: EventMessage) => msg.eventType === EventType.ACQUIRE_TOKEN_NETWORK_START)
  )
  .subscribe((result: EventMessage) => {
    console.warn("notification. ACQUIRE_TOKEN_NETWORK_START");        
  });

Please help.

Vin
  • 15
  • 7
  • Do you even need a filter?, are you sure the `this._destroying$` is not "closed/dead"? – Alejandro Barone Sep 03 '21 at 05:07
  • I have try without pipe and filter but didn't encounter with that scope. See below. this.msalBroadcastService.msalSubject$ .pipe( filter((msg: EventMessage) => msg.eventType === EventType.LOGIN_SUCCESS) ) .subscribe((result: EventMessage) => { console.log(result); this.authService.instance.setActiveAccount(payload.account); }); this.msalBroadcastService.msalSubject$ .subscribe((result: EventMessage) => { console.warn("Remove Pipe"); }); – Vin Sep 03 '21 at 06:14
  • Still open issue, complete code here. https://github.com/AzureAD/microsoft-authentication-library-for-js/issues/4028 – Vin Sep 08 '21 at 07:04

0 Answers0