I am setting the authorization header of an HttpClient
in the following manner:
httpClient
.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(null, "abc");
...but am getting the exception:
"scheme" of the AuthenticationHeaderValue cannot be null.
Why must the AuthenticationHeaderValue
have a scheme? Is this required by a specific RFC?
The scheme is used to determine what kind of authentication you are using:
The header will look like this:
{
"key": "Authorization",
"value": "<scheme> <parameter>"
}
Try to use Postman to see what is generated based on the different types of authentication supported by HTTP.