signinRedirectCallback error No matching state found in storage and Uncaught (in promise): TypeError: n.e is not a function
Hello,
I have an error that loops on my Angular application in production at the time of my callback after I authenticate on Identity server 4 page:

my callback call only the completeAuthentication function:
async completeAuthentication(): Promise<void> {
return this.manager.signinRedirectCallback().then(async user => {
await this.getIdentityProfileCompleteAuthentication(user);
});
}
private getIdentityProfileCompleteAuthentication(user: User) {
return new Promise((resolve) => {
this.identityProfileService.get().subscribe({
next: async profile => {
this.identityProfile = profile;
this.currentUser = user;
this.router.navigate(['/']);
resolve();
},
error: err => console.error(err),
});
});
}
I am using oidc client with the following configuration:
export function getClientSettings(): UserManagerSettings {
return {
authority: 'https://my-identity-app/',
client_id: 'spa',
redirect_uri: 'https://my-app-spa/auth-callback',
automaticSilentRenew: true,
silent_redirect_uri: 'https://my-app-spa/silent-renew.html',
post_logout_redirect_uri: 'https://my-app-spa/',
response_type: 'code',
scope: 'email profile openid my_app_api',
filterProtocolClaims: true,
loadUserInfo: true,
userStore: new WebStorageStateStore({ store: window.localStorage }),
};
}
as well as identity server 4 with this client configuration:
new Client
{
ClientId = "spa",
ClientName = "SPA Client",
RequireConsent = false,
IdentityTokenLifetime = 86400, // one day.
AccessTokenLifetime = 1296000, // 15 days.
ClientUri = $"{configuration.GetValue<string>("Clients:SPAClientUri")}",
AllowedGrantTypes = GrantTypes.Code,
RequirePkce = true,
RequireClientSecret = false,
AllowAccessTokensViaBrowser = true,
RedirectUris =
{
$"{configuration.GetValue<string>("Clients:SPAClientUri")}/auth-callback",
$"{configuration.GetValue<string>("Clients:SPAClientUri")}/silent-renew.html",
},
PostLogoutRedirectUris = { $"{configuration.GetValue<string>("Clients:SPAClientUri")}/index.html" },
AllowedCorsOrigins = { $"{configuration.GetValue<string>("Clients:SPAClientUri")}" },
AllowedScopes = {
IdentityServerConstants.StandardScopes.Email,
IdentityServerConstants.StandardScopes.Profile,
IdentityServerConstants.StandardScopes.OpenId,
IdentityResourcesUtil.Roles,
"my_app_api"
}
}
silent-renew.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<h1 id="waiting">Waiting...</h1>
<div id="error"></div>
<script src="oidc-client.min.js"></script>
<script src="silent-renew.js"></script>
</body>
</html>
silent-renew.js:
var Oidc = window.Oidc,
UserManager = Oidc.UserManager;
if ((Oidc && Oidc.Log && Oidc.Log.logger)) {
Oidc.Log.logger = console;
}
new UserManager().signinSilentCallback()
.catch((err) => {
console.log(err);
});
My app is hosted on Azure. I would also like to point out that on the Azure staging environment, the application works very well, in dev as well.
Thanks for your help, Kevin
Same problem here :/ Tried to clean the local storage when we found the loop but can't solve the problem.
Same here:

Did you ever track this down? Might be related to same site cookies?