C
C#3y ago
null

[.NET Core 6][HttpClient] Storing JWT in cache

Hello, I am trying to figure out a way to store a JWT for a service to service network communication. Currently, I have a background service (IBackgroundService) that requests and stores the JWT in the server's cache. When the JWT expires, the background service requests a new token. The JWT is given to the associated HttpClient, that requires it for communicating with the other service, by constructor injection. Is this considered a good practice? Are there any available information on the topic?
1 Reply
Yawnder
Yawnder3y ago
Side note, you should/could get a new JWT before the previous one expires.
Want results from more Discord servers?
Add your server