Skip to content

[Blazor-WASM 3.2 Preview 2] Msal: Can not set CacheLocation in configuration.  #19958

Closed
@WarrenCrabb

Description

@WarrenCrabb

I have a wasm standalone app that uses AzureAD and I am trying to set the cache configuration to "sessionStorage" but tokens are always stored in localStorage.

When I set the cacheLocation directly it causes a System.NullReferenceException

builder.Services.AddMsalAuthentication(options =>
{
    var config = options.ProviderOptions;
    config.Authentication.Authority = "https://login.microsoftonline.com/22222222-2222-2222-2222-222222222222";
    config.Authentication.ClientId = "11111111-1111-1111-1111-111111111111";
    config.Cache.CacheLocation = "sessionStorage";
});

and when I try to set the configuration as :

config.Cache = new MsalCacheOptions
{
    CacheLocation = "sessionStorage",                 
};

It appears to have no effect and the cache location is still in Local Storage and user auth state persists across browser tabs and after closing/reopening the browser.

https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-core/src/Configuration.ts#L50

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions