I'm trying to use the Reddit API (https://github.com/reddit-archive/reddit/wiki/OAuth2) in my ASP.NET Core MVC app, and to obtain a token I have to make a POST to a URI with HTTP Basic Authorization (username and password being a client id and secret). Currently I use this code:
public async Task<HttpResponseMessage> HttpPost(string uri, string value) { HttpClient httpClient = new HttpClient(); HttpResponseMessage httpResponseMessage = await httpClient.PostAsync(uri, new StringContent(value)); return httpResponseMessage; } However, this doesn't use the authorization. How can I add authorization? I tried looking at the documentation for HttpClient.PostAsync and HttpContent, but I don't see anything relevant.