2 Replies Latest reply on Sep 13, 2017 6:06 AM by Sreelatha Kandi

    Request header field Token is not allowed by Access-Control-Allow-Headers in preflight response.

    Sreelatha Kandi

      Hi!

       

      We have a .Net web application with CanJS framework on the front end. I have some javascript code like below to connect to our Tableau server (V10) which is hosted on a different server.

       

       

                              $.ajax({

                                  url: "http://XXXXXXXXX/api/2.3/auth/signin",

                                  type: "post",

                                  body: "<tsRequest> <credentials name='XXXXXXXX' password='XXXXXXXX' ><site contentUrl='' /> </credentials> </tsRequest>",

                                  headers: { 'Content-type': 'text/xml' },

                                  success: function (data, status) {

                                      console.log("=================> success status: " + status);

                                  },

                                  error: function (jqXHR, status, errorThrown) {

                                      console.log("=================> error status: " + status);

                                  }

                              });

       

      If I run the above code from a http server on my machine, it works fine. I am logged into my tableau server and I get the token back. But when I run this code on my local IIS server it throws the following error.

       

      XMLHttpRequest cannot load http://XXXXXXXXXX/api/2.3/auth/signin. Request header field Token is not allowed by Access-Control-Allow-Headers in preflight response.

       

      Has anyone had any luck? Help appreciated. Thanks!