4 Replies Latest reply on Aug 24, 2016 11:05 PM by arosenthal

    Using Fiddler to pass Kerberos Authentication PIWebAPI 2016 SP1

    mchung

      Is this possible?

       

      Thanks,

      Max

        • Re: Using Fiddler to pass Kerberos Authentication PIWebAPI 2016 SP1
          pmartin

          In the past I've used the "Automatically Authenticate" option (with no other headers needed) in the Options menu.  Does this work for you?

            • Re: Using Fiddler to pass Kerberos Authentication PIWebAPI 2016 SP1
              mchung

              awesome possum!!! thanks worked.

              • Re: Using Fiddler to pass Kerberos Authentication PIWebAPI 2016 SP1
                mchung

                Thanks for the Fiddler tip; however, I was wondering how you would go about passing Kerberos when making an application.

                 

                I am going though the Online WebAPI course and I came across the following code:

                 

                 

                <!DOCTYPE html>

                <html>

                <head>

                    <title>PI Web API CORS Testing</title>

                    <meta charset="utf-8" />

                    <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.min.js"></script>

                </head>

                <body>

                    <p>Click to get a list of AF Databases</p>

                    <button id="getDB">Get Databases</button>

                    <ul></ul>

                 

                    <script>

                        $(document).ready(function () {

                            $('#getDB').click(function () {

                                $.ajax({

                                    url: "https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",

                                    success: function (data) {

                                        for (i = 0; i < data.Items.length; i++) {

                                            $('ul').append('<li>' + data.Items[i].Name + '</li>');

                                        }

                                    },

                                    error: function (xhr) {

                                        console.log(xhr.responseText);

                                    },

                                    beforeSend: function (xhr) {

                                      xhr.setRequestHeader('Authorization', 'Basic asdasdasd');

                                    }

                                });

                            });

                        });

                    </script>

                </body>

                </html>

                 

                 

                 

                Thanks,

                Max

                  • Re: Using Fiddler to pass Kerberos Authentication PIWebAPI 2016 SP1
                    arosenthal

                    If using jQuery to make your AJAX calls, you can use:

                     

                    $.ajaxSetup({
                         xhrFields: {
                              withCredentials: true
                         }
                    });
                    

                     

                    before any of your normal AJAX calls take place (or include this setting with your AJAX call).

                     

                    If using AngularJS, you can use:

                     

                    $httpProvider.defaults.withCredentials = true;
                    

                     

                    or (if you don't want to inject the $httpProvider service):

                     

                    $http.get(url, { withCredentials: true });
                    
                    2 of 2 people found this helpful