4 Replies Latest reply on Dec 29, 2015 8:20 AM by Marcin Lapaj

    Embedding a trusted authentication Tableau

    Marcin Lapaj

      Hi,

       

      I am trying to embed Tableau view in my web app.

      I have found some examples and this docu: Tableau JavaScript API Concepts--Authentication

       

      Obviously it doesn't work (otherwise I would not post in here ).

      I have the server end set up and my IP is added as Trusted. I can make a Server side post to obtain a valid ticket.

      This ticket I can than use in my browser: http://myTableauServer.net/trusted/TicKet/views/foo/Bar?FromDate=2015-01-01&ToDate=2015-08-31&other_param=ShowMore&:showVizHome=no&:embed=true

       

      Then I try to embed this on my page using the JS API:

       

      function initpage() {
          $.ajax({
                url: "/service/tableau/getTicket",
                type: "POST",
                success: function (token) {
                   initializeViz(token);
                },
                error: function () {
                    alert('error');
                }
            });
      }
      
      var viz, workbook, activeSheet;
      
      function initializeViz(ticket) {
           var placeholderDiv = document.getElementById("tableauPlaceholder");
           var url = "http://myTableauServer.net/trusted/"+ticket+"/views/foo/Bar?FromDate=2015-01-01&ToDate=2015-08-31&other_param=ShowMore&";
           var options = {
                 width: 1200,
                 height: 1500,
                 hideTabs: true,
             };
           viz = new tableauSoftware.Viz(placeholderDiv, url, options);
      }
      

       

      The initpage is called when pressing a button.

       

      This code generates me an iframe that is showing the Tabeau login form and no the charts.

      Any idea what might be wrong?