question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature Request] Persist tokens cache between app restart for local development with `dotnet watch`

See original GitHub issue

Is your feature request related to a problem? Please describe.

Default template come with AddInMemoryTokenCaches, that throw exception every time when server restart and browser with old cookies tries to load the page (in my case it is Blazor Server application)

Describe the solution you’d like I would like to have a simple solution to persist cache between app restart for local development. It should be included in default template and just works.

Maybe it is possible with cross platform lightweight DB like (like LocalDB or SQLite) and AddDistributedSqlServerCache.

Describe alternatives you’ve considered I wrote a post how to implement custom IDistributedCachethat persist cache in local json file and how to register it for development environment only. https://sergeytihon.com/2021/04/05/dotnet-watch-with-microsoft-identity-web-or-custom-idistributedcache/

Additional context The error after app restart looks like this Internal_Server_Error

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

1reaction
jmprieurcommented, Apr 5, 2021

@sergey-tihon : @jennyf19 also authored an article on how to use a redis cache hosted locally in Docker. This is a very simple solution too: https://github.com/AzureAD/microsoft-identity-web/wiki/Set-up-a-Redis-cache-in-Docker

0reactions
jennyf19commented, Feb 27, 2023

answered.

Read more comments on GitHub >

github_iconTop Results From Across the Web

`dotnet watch` with Microsoft.Identity.Web or custom ...
The only alternative to AddInMemoryTokenCaches is AddDistributedTokenCaches with ability to store tokens in memory, Redis, CosmosDB, SqlServer.
Read more >
Token cache serialization (MSAL.NET) - Microsoft Entra
In-memory token caches are faster than other cache types, but their tokens aren't persisted between application restarts, and you can't control ...
Read more >
Dotnet watch run - Force reload on "rude edit" - .Net 6
The project/browser reloads when I make a change. Awesome! However, sometimes I will be shown this: Unable to apply hot reload because of...
Read more >
Live Reloading Server And Client Side ASP.NET Core Apps ...
In this post I show how I use Browser Sync and `dotnet watch` in combination to provide live reloading for both server and...
Read more >
What Are Refresh Tokens and How to Use Them Securely
This post will explore the concept of refresh tokens as defined by OAuth 2.0. We will learn how they compare to other token...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found