4 Replies Latest reply on Apr 6, 2016 4:54 AM by Tharashasank Davuluru

    hello guys please suggest me the way to perform the task mention below....

    abhijeet sontakke

      Hello everyone I am facing one issue and it is as,

      suppose if one company is hosting tableau server and it is having secure authentication asking for userid and password every time we are trying to log in.

      now I want to integrate tableau reports which is stored on the same server using java script API. but whenever I am trying it I am not able to view my reports I am getting web page error as attached .

      I just want it like it should display the report without any authentication and without any error.

        • 1. Re: hello guys please suggest me the way to perform the task mention below....
          Tharashasank Davuluru

          Hi Abhijjeet ,

           

          If you are using javascript Api then you have to use tokens in your code to do this.

           

          Authentication

          The normal authentication protocol applies for accessing views on a server. If your code is getting a view from Tableau Public, no authentication is required. However, if your code is getting a view from a hosted instance of Tableau Server, authentication is typically required. If the user is not already signed in to the server, Tableau Server redirects the request for a view to the server sign in page, and the user must provide a username and password. After the user has signed in, the browser caches session information, and the user doesn't have to sign in again unless he or she has explicitly signed out of the server, or until the session token expires.

          Trusted Authentication

          If you are working with Tableau Server, and if the server is configured to use trusted authentication, specify the ticket in the URL by first adding trusted after the server name, followed by the ticket. For example:

          var placeholderDiv = document.getElementById("tableauViz"); var url = "http://tabserver/trusted/Etdpsm_Ew6rJY-9kRrALjauU/views/workbookname/viewname"var options = { hideTabs: true, width: "800px", height: "700px" };  var viz = new tableau.Viz(placeholderDiv, url, options);

          Note: Trusted Authentication is not used with Tableau Online.

          • 2. Re: hello guys please suggest me the way to perform the task mention below....
            abhijeet sontakke

            hi tharashasank,

            thank you for your reply and the suggestion it is going to help me a lot .

            one more thing I would like to clear that ..... if we are logged in to the same server then only we are able to redirect to the report with the help of trusted authentication.

            without authentication can't we do that???

            • 3. Re: hello guys please suggest me the way to perform the task mention below....
              Tharashasank Davuluru

              Hi Abhijjet,

               

              As far i know there is no way to do without trusted authentication.

              • 4. Re: hello guys please suggest me the way to perform the task mention below....
                Tharashasank Davuluru

                Hi Abhijjet,

                 

                using System.IO;

                using System.Net;

                using System.Text;

                using System.Web.Mvc;

                using NewTableauProject.Models;

                 

                namespace NewTableauProject.Controllers

                {

                    public class HomeController : Controller

                    {

                        private static string GetTableauAuthenticationTicket()

                        {

                            var user = "<username>"; //UserInformation.GetAuthenticatedUsername();

                            var request = (HttpWebRequest)WebRequest.Create("http://<servername>/trusted");

                 

                            var encoding = new UTF8Encoding();

                            var postData = "username=" + user;

                            postData += "&target_site=<sitename>";

                            byte[] data = encoding.GetBytes(postData);

                 

                            request.Method = "POST";

                            request.ContentType = "application/x-www-form-urlencoded";

                            request.ContentLength = data.Length;

                 

                            using (var stream = request.GetRequestStream())

                            {

                                stream.Write(data, 0, data.Length);

                            }

                 

                            var response = (HttpWebResponse)request.GetResponse();

                            return new StreamReader(response.GetResponseStream()).ReadToEnd();

                        }

                    }

                }