In my place of work we have our own azure devops server for source control I've written a C# application that interacts with it using REST calls with the HttpClient class Everything works fine but at the moment I have to use a personal access token for my API calls to work
I couldn't find any other solution that I can implement (or at least that I understand HOW to implement) other than that as I don't have administrator privileges on that server
I was wondering... How is it that when I make GET calls from my internet explorer and get the json response but I can't implement the same behavior in my C# HtppClient calls?
Is it possible to use my windows credentials as authentication to the azure devops REST API?
It seems the solution was quite simple I added UseDefaultCredentials to the constructor of HttpClient like that:
client = new HttpClient(new HttpClientHandler() { UseDefaultCredentials = true }); ;
and that actually works! All my REST calls work without using PAT at all
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.