A cloud-based identity and access management service for securing user authentication and resource access
I think that u can’t caz the iframe only reads it if the IDP allows 3rd‑party cookies.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
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({})
}
})
A cloud-based identity and access management service for securing user authentication and resource access
I think that u can’t caz the iframe only reads it if the IDP allows 3rd‑party cookies.
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
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.