# Using local storage instead of session storage in Blazor WASM app

**URL:** <https://community.auth0.com/t/using-local-storage-instead-of-session-storage-in-blazor-wasm-app/180561>\
**Category:** Get Help\
**Tags:** sessions, access-token\
**Created:** [February 3, 2025, 12:31pm UTC](https://community.auth0.com/t/using-local-storage-instead-of-session-storage-in-blazor-wasm-app/180561 "2025-02-03T12:31:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![danclarke-smve](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/danclarke-smve/32/57893_2.png) [@danclarke-smve](https://community.auth0.com/u/danclarke-smve)\
**Post date:** [February 3, 2025, 12:31pm UTC](https://community.auth0.com/t/using-local-storage-instead-of-session-storage-in-blazor-wasm-app/180561/1 "2025-02-03T12:31:44Z")

</div>

We’re moving from Azure B2C to Auth0 in our Blazor WASM app (following [this article](https://auth0.com/blog/securing-blazor-webassembly-apps/) to get it working).

This works, but because it defaults to using session storage for the tokens, if the user opens a new browser tab, they need to authenticate.

We want to switch to local storage, which is what we’re using in B2C.

Reading [this GitHub issue](https://github.com/dotnet/aspnetcore/issues/40757), it looks like it’s not possible? (well, not without a pretty horrendous hack)

Is this correct? It’s not a great user-experience having to sign in again every time the user opens a new tab.

Thanks for your help,  
Dan

---

<div class="post-metadata">

**Author:** ![remus.ivan](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/remus.ivan/32/68771_2.png) [@remus.ivan](https://community.auth0.com/u/remus.ivan)\
**Post date:** [February 3, 2025, 8:31pm UTC](https://community.auth0.com/t/using-local-storage-instead-of-session-storage-in-blazor-wasm-app/180561/3 "2025-02-03T20:31:04Z")

</div>

Hi @danclarke-smve,

Thank you for posting your question on our community page.

Personally, I would not solely rely on that github post when it comes to your particular use case because it might be a little outdated. From the research that i have done around this you should also be able to use the **Blazored LocalStorage Library** that will provide access to `localstorage` within your application. You can check it out using [this link](https://github.com/Blazored/LocalStorage) on github.

This way you can set the `cacheLocation: 'localstorage'` paramater in your implementation. Additionally you can also configure your integration with [Refresh Token Rotation](https://auth0.com/docs/secure/tokens/refresh-tokens/refresh-token-rotation) in order to prevent possible re-authentication issues.

I hope this helped and if you have additional questions please do no hesitate to ask.  
Thanks,  
Remus

---

<div class="post-metadata">

**Author:** ![danclarke-smve](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/danclarke-smve/32/57893_2.png) [@danclarke-smve](https://community.auth0.com/u/danclarke-smve)\
**Post date:** [February 4, 2025, 8:07am UTC](https://community.auth0.com/t/using-local-storage-instead-of-session-storage-in-blazor-wasm-app/180561/4 "2025-02-04T08:07:37Z")

</div>

Hi @remus.ivan - It’s not my code that’s interacting with the browser storage though, so I can’t just swap out for a different storage library. It’s the OIDC library that’s interacting with it.
