Replies: 1 comment 14 replies
-
You actually can access the httpcontext from the delegate. Take a look a this for example. Why it didn't work in your case? |
Beta Was this translation helpful? Give feedback.
14 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
Consider the following code
`
Where getUserName is a delegate function that gets the current username. In an ASP.NET CORE application, how would you go about getting the username or details? Lets say you want to get the access_token to extract what you need. The only way to do that is by accessing the HttpContext. However, the context is not accessible from the Startup and I tried to use IHttpContextAccessor which does not work. I have seen some using the Thread's Principal to store the name which I guess would work but this is not ideal as I would be storing an access_token in the Name property of Identity.
Any ideas how to best solve this?
Beta Was this translation helpful? Give feedback.
All reactions