I have created my channel factory using the following.
var client = GetMyChannelFactory<MyService>();
var myService = client.CreateChannel();
//Add token before this as following method cannot be called by anonymous
var result = myService.GetResult();
internal ChannelFactory<T> GetFirmChannelFactory<T>()
{
BasicHttpBinding basicHttpBinding = GetBasicHttpBinding();
string url = "example.com";
EndpointAddress address = new EndpointAddress(url);
return new ChannelFactory<T>(basicHttpBinding, address);
}
I have the following token to be added in the header of the WCF request which I am calling.
var token = applicationUser.Token.Result;
I tried adding EndPoint behavior but no success.
How can I add authorization bearer token into the WCF request header?