C#C
C#3y ago
Messiah

❔ How do yall do HttpClient tokens?

I have a typed http client factory in ASP.NET that I need an OAuth2 token to be shared amongst this type.

Is there a library for helping with this or do I have to code it manually?

I'm guessing I can put the token in a memory cache, but how do I add the token to each request? Google-fu told me I could use a middleware, but this would regenerate the token with each request, instead of only when it's needed.
Was this page helpful?