C#C
C#4y ago
1 reply
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?
Was this page helpful?