I'm trying to work out how to communicate with Jive's v3 API with .NET. My company uses SSO with Jive, and when opening the request URL in a browser I do receive the information desired, but when I make the request as shown below via .NET, I receive a 401 Unauthorized error.
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://myCompany/jiveon.com/api/core/v3/people");
request.Method = "GET";
request.Accept = "application/json";
request.Credentials = new NetworkCredential(username, password);
request.UseDefaultCredentials = true;
request.PreAuthenticate = true;
request.Headers[HttpRequestHeader.Authorization] = "Basic " + Convert.ToBase64String(Encoding.ASCII.GetBytes(username + ":" + password));
I've tried every variation of this I can think of and I always received 401 Unauthorized. The only clue I have to what's wrong is that when I tried to open the URL in Chrome's Incognito mode (preventing the browser from identifying itself automatically with my work credentials) but provide the credentials like this: "https://username:password@myCompany/jiveon.com/api/core/v3" I receive the same unauthorized error.
Am I misunderstanding some aspect of authorization/authentication for the API? Does SSO not translate to Basic Auth the way I think it does?