How to call a REST Web API for access token with these cURL commands - in C#
If you are planning on using curl for many different tasks, instead of rewriting the tool. Just download the windows compatible version and embed it as a resource in your console application.
Windows (32 bit) version of curl.exe - https://akamai.bintray.com/5a/5aa976c1cfc96d95a12cb469ce9bbb1b193ae7599d446f4a22d023a585c5ffe9?gda=exp=1455730084~hmac=85d7d80271ecba52893dacb956690dedd020c0ad61f2943b28adcc43ce14e45a&response-content-disposition=attachment%3Bfilename%3D%22curl-7.47.1-win32-mingw.7z%22&response-content-type=application%2Fx-www-form-urlencoded
Edit - Something like this:
Process p = new Process();p.StartInfo.UseShellExecute = false;p.StartInfo.RedirectStandardOutput = true;p.StartInfo.FileName = "C:\CURL\curl.exe";p.StartInfo.Arguments = "-i -L -H 'Accept: application/json' -d 'client_id=APP-GWTDOE3CX89FH7FD' -d 'client_secret=5160c539-4ec9-4e8c-8966-580df68b494f' -d 'scope=/read-public' -d 'grant_type=client_credentials' 'https://pub.sandbox.orcid.org/oauth/token'"; p.Start();string output = p.StandardOutput.ReadToEnd();p.WaitForExit();Console.WriteLine(output);