1) Users are prompted to login to Tableau when viewing an embedded dashboard within a web application.
2) If they close their browser, start a different browser session, or let the Tableau cookie expire, they will be prompted to login again.
3) Throughout the day, you could potentially be prompted to login multiple times when trying to view dashboards. This quickly becomes annoying and tiresome.
Tableau offers a solution called "Trusted Authentication" which bypasses the manual login process. After a week of debugging and troubleshooting, I was able to accomplish this. I could not find any solutions on Stackoverflow, so I wanted to share my knowledge on how I accomplished this in hope to help others.
This is how I did
Controller
Java Script
Link to Tableau's How Trusted Authentication Works
High Level View on how I implemented Trusted Authentication
1) Tableau server must have an entry to the wgserver.trusted_hosts file with the hostname of your web application for any of this to work.
2) Three important parameters are passed:
3) If the HTTP POST request is valid and the user has the correct Tableau license, Tableau creates a 48 unique character ticket that is only valid for 3 minutes.
4) I programmatically add the 48 unique character ticket into the embedded JavaScript right before Tableau redeems it.
How the code works in my web applicatin
I created a TrustedAuth class that contains two methods:
requestTicket()
andaddTicket()
.requestTicket()
is an Asynchronous method that takes the three required parameters (sso, server, site). The HTTP POST is fired off and awaits a response. If Tableau response is a -1 , HTTP handshake has failed or the user is invalid. If valid, response will be a 48-character encrypted string.addTicket()
is a Synchronous method that takes two parameters (ticket, reportLink). This method takes the 48-character encrypted ticket and appends it to the embedded JavaScript (reportLink).The web application sends a HTTP GET request to Tableau that includes the embedded JavaScript (reportLink) with the encrypted ticket. Tableau Server redeems the ticket, creates a session, logs the user in, no login prompt dispalyed
TrustedAuth Class
Dashboard Controller
New Embedded JavaScript (reportLink) with ticket parameter inserted
Dashboard View
If all works, you should no longer see the Tableau Login Page.