1 of 1 people found this helpful
Can you provide more details of your Tableau Server configuration? Are you using local users? Active Directory? Trusted Authentication?
The first thing that comes to my mind would be to create a single user for this limited "view only" purpose in Tableau Server (assuming you're not using Active Directory). Then configure Tableau Server for trusted authentication (Tableau Server will need to trust the server where the PHP code / website is running). You can then embed a view in your PHP page. This embedded view can be configured to request a ticket for the user you created (hard code the user in the PHP page) and then use that ticket in the URL to the Tableau view that will be rendered in the page.
Trusted Authentication - this resource has details of how trusted authentication works as well as examples that can be adapted for your scenario.
I believe hard coding the user in for something like this would be violating the EULA
You may be right about the EULA. Based on the original question I was not sure if the page was for public consumption or internal only.
For example, if you are already using trusted auth to allow internal users to access the Tableau viz, then you have probably turned the guest account off. In this scenario, if you still have a Viz that is intended to public consumption on the website, you have no way to enable it unless you do what I described.
That said, if the users in Tableau (usernames) match the users (usernames) that are used to log in to the PHP site, then you can use trusted auth in the way it was intended and not in violation of any EULA. You simply need to be able to obtain the username of the user in the PHP page and use that to request the auth ticket from Tableau Server. Of course you also need to enable trusted authentication and add the PHP server (IP or Name/FQDN) to the list of trusted hosts on the Tableau Server.
This resource should provide some guidance. Trusted Authentication
There are also some example resources in the Tableau Embedding folder on your Tableau Server (included with your install). One of these examples is for PHP.
Absolutely Michael! As long as you can obtain the username from the PHP script, that username can be sent to request a ticket and then use in trusted auth. Here's a sample script:
$username = $_POST['username']; # Retrieve username from user's input
$server = $_POST['server'] . "/trusted"; # Retrieve server URL from user's input and add /trusted
$site = $_POST['site']; # Retrieve site ID from user's input
$view = $_POST['view']; # Retrieve view URL from user's input
$ch = curl_init($server); # Initialize cURL session
$data = array('username' => $username, 'target_site' => $site); # Data to send, add site ID or IP address for validation if desired. For example:
# array('username' => $username, 'target_site' => $site_id, 'client_ip' => $client_ip_address)
# See http:#onlinehelp.tableausoftware.com/current/server/en-us/help.htm#trusted_auth_webrequ.htm
curl_setopt($ch, CURLOPT_POST, true); # Tells cURL to use POST method
curl_setopt($ch, CURLOPT_POSTFIELDS, $data); # Tells cURL what data to post
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); # Return ticket in a variable instead of displaying it on the screen
$ticket = curl_exec($ch); # Execute cURL function which will post to Tableau Server and retrieve ticket into this variable
curl_close($ch); # Close the cURL session
<iframe src="$server/$ticket/$view" width="600" height="600"></iframe> # For default site
<iframe src="$server/$ticket/t/$site/$view" width="600" height="600"></iframe> # For non-default site
Hi, I have the same question but it goes with Tableau Online. And with your code it doesn't work. Any suggestion?
Trusted authentication cannot be used with Tableau Online.
Is there any alternative for Tableau Online of this purpose?
Hi IT SIB,
I think Alternative way is to use SAML Authentication.
Thanks & Regards,