According to this topic I am using this block of code
public object BeforeSendRequest(ref System.ServiceModel.Channels.Message request, System.ServiceModel.IClientChannel channel)
{
HttpRequestMessageProperty httpRequestMessage;
object httpRequestMessageObject;
if (request.Properties.TryGetValue(HttpRequestMessageProperty.Name, out httpRequestMessageObject))
{
httpRequestMessage = httpRequestMessageObject as HttpRequestMessageProperty;
if (string.IsNullOrEmpty(httpRequestMessage.Headers[USER_AGENT_HTTP_HEADER]))
{
httpRequestMessage.Headers[USER_AGENT_HTTP_HEADER] = this.m_userAgent;
}
}
else
{
httpRequestMessage = new HttpRequestMessageProperty();
requestMessageProperty.Headers.Add("Authorization", token);
request.Properties.Add(HttpRequestMessageProperty.Name, httpRequestMessage);
}
but unfortunately since I move code from .net framwork 4.7 to .net core 2.1 project I am getting this error code:
Failed to copy the HTTP header 'Authorization' with value 'qqqqqqqqq=' to 'System.Net.Http.Headers.HttpRequestHeaders'.\r\nThe format of value 'qqqqqqqqq=' is invalid.
In old project everything worked fine Is possible to skip Authorization header validation? Thank you