6 Replies Latest reply on Nov 12, 2013 4:06 PM by altfo

    Jive authentication using Okta. REST API Error - The remote server returned an error: NotFound.

    altfo

      Hi,

      My company uses the Okta for the authentication for Jive. I am trying to consume the REST API by C#. I tried the below code. But getting error "The remote server returned an error: NotFound."

       

      public void GetAuthorizationSession()

      {

           HttpWebRequest request = (HttpWebRequest)WebRequest.Create(https://<domain here>/api/core/v3/authentication/formlogin?username={+ Utility.JiveUserId +"}&password={" + Utility.JivePwd +  "}");

        request.Method = "POST";

        request.ContentType = "application/x-www-form-urlencoded";

        request.BeginGetResponse(new AsyncCallback(ReadWebRequestCallback), request);

      }


      private void ReadWebRequestCallback(IAsyncResult callbackResult)

        {

         HttpWebRequest myRequest = (HttpWebRequest)callbackResult.AsyncState;

        HttpWebResponse myResponse = (HttpWebResponse)myRequest.EndGetResponse(callbackResult);

        using (StreamReader httpwebStreamReader = new StreamReader(myResponse.GetResponseStream()))

        string results = httpwebStreamReader.ReadToEnd();

         Dispatcher.BeginInvoke(() => TextBlockResults.Text = results);

      }

       

      I also tried the Basic Authentication code with the Network Credential. It returns the same error. Anyone can help me on this?