1 Reply Latest reply on Feb 7, 2017 2:25 PM by Dillon Scaduto

    Authentication Problems 'Access-Control-Allow-Origin'

    Dillon Scaduto

      Hello,

       

      I am having trouble sending a request to my tableau server. I have followed the steps on these pages (Get a Ticket from Tableau Server), but I keep getting this error :

            No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8888' is therefore not allowed access.

       

      I am using GWT 2.8.0 and the code sample looks like this

       

      String url = "http://tabserv/trusted/?username=USER1";
      RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode(url));
      try {

        Request request = builder.sendRequest("", new RequestCallback() {

         public void onError(Request request, Throwable exception) {

              // Couldn't connect to server (could be timeout, SOP violation, etc.)
              LOGGER.error("couldnt connect");
         }

         public void onResponseReceived(Request request, Response response) {

              if (200 == response.getStatusCode()) {

                   // Process the response in response.getText()
                   String ticket = response.getText();
              } else {

                   // Handle the error. Can get the status text from response.getStatusText()

              }

         }

        });

       

      I have added both local host and 127.0.0.1 to the property file

           wgserver.trusted_hosts: 127.0.0.1, localhost