0 Replies Latest reply on Oct 4, 2018 9:31 AM by Sara Yarshenas

    Embed a document in Angular Js projct

    Sara Yarshenas

      Hello,

      I am trying to display a map created by Tableau on my web application. Our Tableau server is not public, so I am sending a request like following to get the token (I could get that successfully ), then I am trying to use that token to get the document. However when I use the token in this URL, it gives me 403 error :

      https://tableauserver.com/trusted/"+token+"/views/addresstotheview?:iid=1

       

      Then I realized that the X-Tableau-Auth has not been attached to the GET request, while I added that to the header. I also tried to do it on Postman but I got the same error, I have no idea anymore how can I use a token to get the private document.

       

      var req = {

                 method: 'POST',

                 url: 'https://tableauserver.com/api/2.8/auth/signin',

                  header: {

                       'accept': 'application/json',

                       'content-type': 'application/json'

                     },

                  data: { "credentials": { "name":"username", "password": "Password", "site": {"contentUrl": ''}}}

                }

                $http(req).then(function successCallback(response) {

                  console.log("SUCCESS POST");

                  token = response["data"]["credentials"]["token"];

                  console.log("The token is ", token);

                 var get_req = {

                    method: 'GET',

                   url: 'https://tableauserver.com/#/views/addresstotheview?:iid=1 ',

                    header: {

                       'accept': 'application/json',

                       'X-Tableau-Auth': token

                     }

                }

             $http(get_req).then(function successCallback(response) {

                  console.log("SUCCESS GET");

                }, function errorCallback(response) {

                  console.log(response.status);

                });

       

       

                }, function errorCallback(response) {

                  console.log(response.status);

                });

       

       

      Thank you in advance.