Pavel Kononenko
Pavel Kononenko

Reputation: 330

Generate tableau trusted ticket doesn't work C#

I need to get a ticket for displaying tableau server data visualization, but I get -1 instead of ticket always. I tried to use the simple HTML form from this site, but anyway I get -1 from my tableau server.

class Program
	{
		static void Main(string[] args)
		{
			var url = "https://server.com/trusted";
			var encoding = new UTF8Encoding();
			var request = (HttpWebRequest)WebRequest.Create(url);
			var postData = "username=userName";
			postData += "&target_site=ru&client_ip=76.151.88.1";
			byte[] data = encoding.GetBytes(postData);


			request.Method = "POST";
			request.ContentType = "application/x-www-form-urlencoded";
			request.ContentLength = data.Length;

			using (var stream = request.GetRequestStream()) { stream.Write(data, 0, data.Length); }

			var response = (HttpWebResponse)request.GetResponse();
			var ticket = new StreamReader(response.GetResponseStream()).ReadToEnd();
			Console.WriteLine(ticket);
			Console.ReadKey();

		}

Upvotes: 1

Views: 1277

Answers (1)

archangel76
archangel76

Reputation: 1544

For me, the tableau installation had to be configured. Look at this link: https://onlinehelp.tableau.com/current/server/en-us/trusted_auth_trustIP.htm

Note that you can check on the existing list with this command, and then basically add your machine to that list:

tabadmin get wgserver.trusted_hosts

Here's a link that talks about possible solutions. It was handy because it said where the logs were about why it was happening: http://onlinehelp.tableau.com/current/server/en-us/trusted_auth_trouble_1return.htm

Those logs are here:

ProgramData\Tableau\Tableau Server\data\tabsvc\logs\vizqlserver

Upvotes: 1

Related Questions