2 Replies Latest reply on Oct 3, 2017 8:16 AM by Arthur Doe

    Question: How to deal with hard refresh when using JavaScript API?

    Arthur Doe

      Here is the situation:

      1) We get the authentication/authorization token from our Tableau server - let's say it looks like this '8nqqmrs5TUq5nomYA_oUTg==:7IzXitvN1nRPTdSdpcqkMeeW'

      2) We use this on our website to access reports on Tableau server - http://server.com/trusted/8nqqmrs5TUq5nomYA_oUTg==:7IzXitvN1nRPTdSdpcqkMeeW/view/

      3) Up to this moment things are working fine and we can view our report(s),

      4) However, when user does a hard refresh then we get and error.

       

      Q: How can we deal with this issue. We can't really expect our users to be that savvy and not refresh a page when it's been part of the web for years?

      1.jpg

        • 1. Re: Question: How to deal with hard refresh when using JavaScript API?

          Hi Arthur Doe,

           

          Welcome on the Tableau forums

           

          We have updated this article earlier. Could you please try it out?

          Error "Could not locate unexpired trusted ticket" | Tableau Software

           

          Let me know how it goes, thanks.

           

          ----------

          Lénaïc RIÉDINGER, Global Community Engineer Tableau

          Tableau Community Forums | Knowledge Base

          If you see a Helpful or Correct response, please mark it thanks to the buttons below the targeted post!

          • 2. Re: Question: How to deal with hard refresh when using JavaScript API?
            Arthur Doe

            Thanks for help!

            I'm going to try to debug this issue using the information you provided and update this thread if I find the cause.

            Meanwhile, for anybody who may have faced this issue in the past, quick solution is to request new authorization ticket from Tableau server. Our page which contains some static content (navbar, couple of other pannels etc), which shows visualization(s) is completely driven by Tableau.

             

            We are using ASP.NET core 2 (C#) to application to host Tableau's visualizations.

             

            This code will retrieve an authorization token from Tableau Server

             

            public async Task<string> GetToken()

                    {

                        var serverUrl = _configuration["Tableau:serverUrl"];

                        var parameters = new Dictionary<string, string> { { "username", _configuration["Tableau:username"] } };

                        var encodedContent = new FormUrlEncodedContent(parameters);

             

             

                        var client = new HttpClient();

                        client.DefaultRequestHeaders.Accept.Clear();

                        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(@"application/x-www-form-urlencoded"));

                        var responsse = await client.PostAsync(serverUrl, encodedContent).ConfigureAwait(false);

                        return await responsse.Content.ReadAsStringAsync();

                    }

             

            Then in the controller we would just call this like:

            var user = new User()

            user.Token = await GetToken()

            return View(user)

             

            If user ever refreshed the page then visualization would just be re-rendered against new authorization ticket.

            Might not be the best solution but until the cause is found you may use this as an alternative.