Authentication
Important changes for the Tableau JavaScript API
As of February 2024, the Tableau JavaScript API is deprecated. Use the Embedding API v3 instead for embedding interactive views into web pages and applications. For guidance on embedding Tableau views, see the Tableau Embedding API v3 Help(Link opens in a new window).
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);
Trusted Authentication is not used with Tableau Cloud.