11 Replies Latest reply on Nov 28, 2016 1:44 PM by gregor

    How to support Pi Web API "Kerberos Authentication" using nodejs/javascript?

    AniketAmrutkar

      Hi Guys,

      I am working on Pi Web API integration.

      I am using basic authentication without any problem through my node js code.

      Now I want to support kerberos authentication.  I have make changes in system explorer to support "Kerberos" authentication.

      I am using Google Chrome on MacBook. After making Kerberos related changes, I am not able to login into piwebapi using my browser. getting error : "Authorization has been denied for this request."

      However If I try to login from Windows box using chrome browser I can login. Getting following response in /piwebapi/system/configuration :

      {

        "AuthenticationMethods": [

          "Kerberos"

        ],

        "CorsExposedHeaders": "Allow,Content-Encoding,Content-Length,Date,Location",

        "CorsHeaders": null,

        "CorsMethods": "GET,OPTIONS",

        "CorsOrigins": null,

        "CorsSupportsCredentials": false,

        "DisableWrites": false,

        "MaxReturnedItemsPerCall": 1500000,

        "SearchBoosts": [

          1.0,

          0.8,

          0.5,

          0.5,

          0.5,

          0.5,

          0.5

        ],

        "SearchPointAttributes": [

          "pointsource",

          "instrumenttag",

          "location1",

          "exdesc"

        ],

        "SearchScanInterval": 180

      }

      ===========================================================================

      I am having two questions :

      1. How can I login into Pi Web API from macbook?  I visited following article for help but it did not help : https://techsupport.osisoft.com/Troubleshooting/KB/KB01223

       

      2. I am working on integrating Pi Web api , writing code in nodejs.. I am not sure which libraries to use and what approach to take.

      I tried using (https://www.npmjs.com/package/node-krb5)

      --------- Code Snippet ----------

      var krb5 = require('node-krb5');
      var REALM=<server-address>
      var username = <username>
      var password = <password>

      krb5.authenticate(username+'@'+REALM, password, function(err) {
        if (err) {
        console.log("Error: " + err);
        } else {
        console.log("OK");
        }
      });

      -------------------------------

      Getting following error :
      Error: unable to reach any KDC in realm <server-address>, tried 0 KDCs

       

       

      Can you please help me in this