Curl -u equivalent in HTTP request

后端 未结 3 1776
执念已碎
执念已碎 2020-12-17 09:49

I\'ve been trying to plug into the Toggl API for a project, and their examples are all using CURL. I\'m trying to use the C# wrapper which causes a bad request when trying t

3条回答
  •  情话喂你
    2020-12-17 10:34

    As explained to me in another post, you can pass the api token to the user property if you are using HttpWebRequest:

    request.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes($"my-secret-toggl-api-token:api_token")));
    

提交回复
热议问题