client.DefaultRequestHeaders.Authorization code example
Example 1: http client include bearer
httpClient.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", "Your Oauth token");
Example 2: defaultrequestheaders.authorization basic auth
// For basic auth use the following:
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", "encrypted user/pwd");
Example 3: httpclient add authorization header symphony
$response = $client->request('GET', 'https://...', [
'auth_basic' => ['the-username', 'the-password'],
// ...
]);