1

I am creating a .netcore console application which makes API calls to a web application. Before it can make the API call, it needs to authenticate itself to the webapp. I am inheriting the IClientMessageInspector class and trying to add the JWT to MessageHeader.CreateHeader in the following manner -
public object BeforeSendRequest(ref Message request, IClientChannel channel) { request.Headers.Add(MessageHeader.CreateHeader("Cookies", "m3", "jwt="+GetTheJWT())); }

I understand that the JWT is hardcoded and would expire after a time period but currently my concern is that the JWT that I am trying to add as a part of the Header is not getting reflected in the header.
I am receiving the message as HttpRequest object in the web application and I see that JWT is missing as a part of the Cookies Property of the HttpRequest object.

The following are my queries -
1) I wanted to know whether it could be done this way?
2) What am I doing wrong?
3) Is SOAP still relevant with .netcore or do I have to use REST API?
4) Is authentication still possible with SOAP on .netcore using JWT?

Karthikeyan
  • 25
  • 6
  • 13
  • Possible duplicate of [Adding Http Headers to HttpClient](https://stackoverflow.com/questions/12022965/adding-http-headers-to-httpclient) – Robert Perry Feb 09 '19 at 23:17
  • This has already been answered here: https://stackoverflow.com/questions/12022965/adding-http-headers-to-httpclient – Robert Perry Feb 09 '19 at 23:18

0 Answers0