[Bug] Logs error about cache serialization even though one is provided?
See original GitHub issueLogs and network traces 12:58 [Error] [] : False MSAL 4.37.0.0 MSAL.NetCore .NET 5.0.11 Microsoft Windows 10.0.19043 [11-04 11:58:00.33 - 9c02650f-5821-42a0-97c6-a8a7f269e513] The default token cache provided by MSAL is not designed to be performant when used in confidential client applications. Please use token cache serialization. See https://aka.ms/msal-net-cca-token-cache-serialization.
Which version of MSAL.NET are you using? MSAL 4.37.0.0 MSAL.NetCore .NET 5.0.11 Microsoft Windows 10.0.19043
Platform .NET Core 5
What authentication flow has the issue?
- Desktop / Mobile
- Interactive
- Integrated Windows Authentication
- Username Password
- Device code flow (browserless)
- Web app
- Authorization code
- On-Behalf-Of
- Daemon app
- Service to Service calls
Other? We are using MSAL-angular to sign in to azure ad and the token is sent from the client to a web api endpoint that is protected by that. We are using msal for some endpoints and cookies for the rest.
Is this a new or existing app? c. This is a new app or experiment.
Repro
var authBuilder = services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme);
authBuilder.AddMicrosoftIdentityWebApi(Configuration)
.EnableTokenAcquisitionToCallDownstreamApi()
.AddMicrosoftGraph(Configuration.GetSection("DownstreamAPI"))
.AddInMemoryTokenCaches();
authBuilder.AddCookie("Samla", options =>
{
options.Cookie.Name = "auth_cookie";
options.Cookie.HttpOnly = true;
options.Cookie.SameSite = SameSiteMode.None;
options.SlidingExpiration = true;
options.ExpireTimeSpan = TimeSpan.FromDays(14);
options.Events = new CookieAuthenticationEvents
{
OnRedirectToLogin = redirectContext =>
{
redirectContext.HttpContext.Response.StatusCode = 401;
return Task.CompletedTask;
},
};
});
Expected behavior No errors is expected in the log if we add .AddInMemoryTokenCaches()
Actual behavior Getting errors in the log saying that a cache serialization has not been provided
Additional context / logs / screenshots Add any other context about the problem here, such as logs and screenshots.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:12 (6 by maintainers)
Top GitHub Comments
https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/blob/master/src/client/Microsoft.Identity.Client/Internal/Requests/RequestBase.cs#L358
Having looked at this in more detail, it looks like we are logging this error in the correct place:
client_credentials
But the error message is not good:
It should say:
And as per feedback, this should be a warning, not an error.
I would prefer to be aware of all potentiall errors in development and not being suprised by it when I go to production.
I am using 1.20.0 of Microsoft Identity Web