I have setup JWT Authentication in our SnapDevelop Web API using this as a guide:
It seems to be working well so far and I am getting a token back when I call GetJWTToken() in the client app. I have also set a custom request header in our client application as part of JWT Authentication like so:
lnv_RestClient.SetRequestHeader("ID", "123456")
Let's say the user logs in successfully and then makes some service method calls via a controller. How do
I access that request header value in a service method? I've tried var id = Request.Headers["ID"] but it doesn't
understand the 'Request' directive. Is there a 'using' reference I need to add? We are using Serilog and I
am hoping to capture unique values from the client to use in our logs. Mainly I am looking for a way to set and
store value that persist as the user makes various API calls from the PB client.
The user might even open two instances of the PB client app. In this case the userid would be the same but
how could I tell them apart in the log? I've looked at InMemory caching - both native and outside frameworks
like Redis. Setting a cache value seems to be easy but successfully retrieving it is giving me problems.
Thanks, Tom