Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
WarrenCrabb opened this issue Mar 18, 2020 · 2 comments
Closed
Labels
area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly ✔️ Resolution: Duplicate Resolved as a duplicate of another issue Status: Resolved

Comments

@WarrenCrabb
Copy link

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

@mkArtakMSFT mkArtakMSFT added the area-blazor Includes: Blazor, Razor Components label Mar 18, 2020
@javiercn javiercn added the feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly label Mar 18, 2020
@javiercn
Copy link
Member

@WarrenCrabb thanks for contacting us.

We'll take a look at this issue and get back to you.

@mkArtakMSFT
Copy link
Member

Closing as this is being tracked in the referenced issue.

@mkArtakMSFT mkArtakMSFT added the ✔️ Resolution: Duplicate Resolved as a duplicate of another issue label Mar 19, 2020
@ghost ghost added the Status: Resolved label Mar 19, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Apr 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly ✔️ Resolution: Duplicate Resolved as a duplicate of another issue Status: Resolved
Projects
None yet
Development

No branches or pull requests

3 participants