Unable to make call with Windows authenication enabled in Telligent website

Unable to make call with Windows authenication enabled in Telligent website

This question has suggested answer(s)

I have install Telligent Enterprise version 3.1.0.23780 for developing application.

 

Case 1 : Form authentication and anonymous user enabled rest all disabled in Telligent enterprise website

 I call REST Telligent API (Endpoint) then it works fine.

Case 2 : Windows authentication enable rest all disabled in Telligent enterprise website

I call REST Telligent API ( Endpoint ) then I get error “Unauthorized” Error 401 Could you please suggest how to resolve this problem?

 

Do we need to do anything specific while calling Telligent API when we enable Windows authentication mode in Telligent?

 

Thanks ,

Niranjan

All Replies
  • See how to access the REST API through Windows authentication:

    telligent.com/.../20910.how-to-access-rest-api-through-windows-authentication.aspx

  • I reveiced the below details after following the above authentication mechanism :

    //code snippet start

               var webClient = new WebClient();

               webClient.Credentials = CredentialCache.DefaultNetworkCredentials;

              var adminKey = String.Format("{0}:{1}","cfg.adminkey", cfg.accountkey);

             // cfg object has admin key and account key -> reading from configuration file

               var adminKeyBase64 = Convert.ToBase64String(Encoding.UTF8.GetBytes(adminKey));

               webClient.Headers.Add("Rest-User-Token", adminKeyBase64);

               var requestUrl = "http://blrkct0123pc/telligententerprise/api.ashx/v2/users.xml";

               try

               {

                   string xml = string.Empty;

                   try

                   {

                       xml = webClient.DownloadString(requestUrl);

                       LogEngine.WriteLogMessage(" Call REST URI Result = " + xml, eventlogpath);

                   }

                   catch (WebException ex)

                   {

                       using (var reader = new StreamReader(ex.Response.GetResponseStream()))

                       {

                           var responsexml = reader.ReadToEnd();

                           //Console.WriteLine(responsexml);

                           LogEngine.WriteLogMessage("** Catch Exception : " + responsexml.ToString() + "while calling URI: " + requestUrl, eventlogpath);

                                              }

                   }

    // code snippet ends

    Encountered the following error deatils in webexception

    Most likely causes:

    •The username supplied to IIS is invalid.

    •The password supplied to IIS was not typed correctly.

    •Incorrect credentials were cached by the browser.

    •IIS could not verify the identity of the username and password provided.

    •The resource is configured for Anonymous authentication, but the configured anonymous account either has an invalid password or was disabled.

    •The server is configured to deny login privileges to the authenticating user or the group in which the user is a member.

    •Invalid Kerberos configuration may be the cause if all of the following are true:

    ◦Integrated authentication was used.

    ◦the application pool identity is a custom account.

    ◦the server is a member of a domain.

    Things you can try:

    •Verify that the username and password are correct, and are not cached by the browser.

    •Use a different username and password.

    •If you are using a custom anonymous account, verify that the password has not expired.

    •Verify that the authenticating user or the user's group, has not been denied login access to the server.

    •Verify that the account was not locked out due to numerous failed login attempts.

    •If you are using authentication and the server is a member of a domain, verify that you have configured the application pool identity using the utility SETSPN.exe, or changed the configuration so that NTLM is the favored authentication type.

    •Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click here.

     

    PS: Same application code is working with development setup ( having single domain )but it not woring in cross domain set up.

    Thanks and regards,

    Niranjan

  • Based on the error message it appears that the user running the application does not have access to the web site.

    Per: msdn.microsoft.com/.../system.net.credentialcache.defaultnetworkcredentials.aspx

    The credentials returned by DefaultNetworkCredentials represents the authentication credentials for the current security context in which the application is running. For a client-side application, these are usually the Windows credentials (user name, password, and domain) of the user running the application.

    What I would do is to try specifically setting the username/password for the network credentials to a user that I know has permission to access the site via Windows login (like myself) and make sure that that works first before moving on to something else.