Share via

Silent SSO not working in Angular MSAL

Ahmad Mujeeb 10 Reputation points
2026-02-20T21:29:33.9266667+00:00

In my application, silent SSO sign-in isn't working as expected. When I log in on one tab and then open a new tab, I get the following error: no_account_error: No account object provided to acquireTokenSilent and no active account has been set. The error is occurring when I call the acquireTokenSilent function and as a result is making me login again. The relevant code is below. Also to note I'm using session storage as well

const response = await this.msalService.instance.handleRedirectPromise();
    
    if(response!== null && response.account !== null) {
        this.msalService.instance.setActiveAccount(response.account);
        return
    }


    const accounts = this.msalService.instance.getAllAccounts();
    
    if(accounts.length > 0) {
      this.msalService.instance.setActiveAccount(accounts[0]);
    }


    const silentRequest = {
      scopes: ["User.Read"],
    }


    const result = this.msalService.acquireTokenSilent(silentRequest).subscribe({
      next: (result) => {
        console.log("acquireTokenSilent response:", result);
      },
      error: (error) => {
        console.error("acquireTokenSilent error:", error);
        this.loginRedirect({})
      }
    })

Microsoft Security | Microsoft Entra | Microsoft Entra ID
{count} votes

3 answers

Sort by: Most helpful
  1. kagiyama yutaka 1,245 Reputation points
    2026-02-21T03:11:03.3666667+00:00

    I think that u can’t caz the iframe only reads it if the IDP allows 3rd‑party cookies.


  2. Bruce (SqlWork.com) 83,581 Reputation points Volunteer Moderator
    2026-02-21T02:47:04.0133333+00:00

    By default msal stores token in session cache which is not shared between tabs. You must configure msal to to use local storage instead which is shared:

    https://learn.microsoft.com/en-us/entra/msal/javascript/browser/caching


  3. kagiyama yutaka 1,245 Reputation points
    2026-02-21T02:02:04.32+00:00

    I think silent SSO wont hold on sessionStorage and u need localStorage + a tiny BroadcastChannel ping to pre-hydrate the acct ctx or MSAL stays blind. sorry if i was wrong.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.