Dofactory.com
Dofactory.com

How to set the Authorization Header of HttpClient in C#

Here's how to set the authorization header:


var clientHandler = new HttpClientHandler();

var client = new HttpClient(clientHandler);

client.DefaultRequestHeaders.Authorization = 
    new AuthenticationHeaderValue("Bearer", "Your Oauth token");


Jack Poorte
Jack Poorte
Last updated on Sep 30, 2023



Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Cookies       Do Not Sell       Licensing      
Made with    in Austin, Texas.  - vsn 44.0.0
© Data & Object Factory, LLC.