AzureAD / microsoft-authentication-library-for-js

Microsoft Authentication Library (MSAL) for JS
http://aka.ms/aadv2
MIT License
3.66k stars 2.64k forks source link

MSAL throws clientAuthError #2419

Closed NishanthRE closed 4 years ago

NishanthRE commented 4 years ago

At firsttime login with the msal is working fine. when i try to open the same application in another tab it throws an error as clientAuthError: The idToken is null or empty. Please review the trace to determine the root cause. Raw ID Token Value: null Screenshot (482)

using the latest version of msal and @azure/msal-angular. please have a look into it and help me to get out from this issue.

code sampe:

return from(
      this.msalSvc.acquireTokenSilent({ scopes })
        .then((response: AuthResponse) => {
          defaultHeaders['Authorization'] = accessToken;
          return request.clone({
            setHeaders: defaultHeaders
          });
        })
    )
      .pipe(
        mergeMap(nextReq => next.handle(nextReq).pipe(
          map((event: HttpEvent<any>) => {
            if (event instanceof HttpResponse) {
            }
            return event;
          }),
          catchError((error: HttpErrorResponse) => {
            return throwError(error);
          })
        )),
        tap(
          event => { },
          err => {
            if (err instanceof HttpErrorResponse && err.status === 401) {
              this.msalSvc.clearCacheForScope(accessToken);
            }
            return err;
          }
        )
      );

Thanks in advance

sameerag commented 4 years ago

@NishanthRE Can you please share your configuration? If you are using sessionStorage you will not be able to share authentication across tabs.

NishanthRE commented 4 years ago

Sameera, Thanks for the response. I have fixed it by myself.

Get Outlook for Androidhttps://aka.ms/ghei36


From: Sameera Gajjarapu notifications@github.com Sent: Thursday, October 15, 2020 10:26:06 PM To: AzureAD/microsoft-authentication-library-for-js microsoft-authentication-library-for-js@noreply.github.com Cc: Nishanthkumar M nishanthkumar@cloudiq.io; Mention mention@noreply.github.com Subject: Re: [AzureAD/microsoft-authentication-library-for-js] MSAL throws clientAuthError (#2419)

@NishanthREhttps://github.com/NishanthRE Can you please share your configuration? If you are using sessionStorage you will not be able to share authentication across tabs.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/AzureAD/microsoft-authentication-library-for-js/issues/2419#issuecomment-709457931, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKJDF2VO3T3G6OGN6MAUBOTSK4SSNANCNFSM4SQJVTLQ.