0
votes
import React, { Component } from 'react';  
import tableau from 'tableau-api';  


class App extends Component {  
  componentDidMount() {  
    this.initViz()  
  }  


  initViz() {  
    const vizUrl = 'http://public.tableau.com/views/RegionalSampleWorkbook/Storms';  
    const vizContainer = this.vizContainer;  
    let viz = new window.tableau.Viz(vizContainer, vizUrl)  
  }  


  render() {  
    return (  
      <div ref={(div) => { this.vizContainer = div }}>  
      </div>  
    )  
  }  
}  


export default App;  

public tableau

it works when i publish my workbook to public tableau with extract data source

but when i publish the same in tableau with live data source(sql),

tableau dashboard I obtained a url,

https:///#/site/testsite/views/genderanalysis/Sheet2?:iid=1

and that when i used here not working

and from the doc, i found api with unique-token https:// /trusted/%3CTRUSTED%20TICKET%20HERE%3E/t/testsite/views/genderanalysis/Sheet2?:embed=yes&:comments=no&:toolbar=yes&:refresh=yes&:embed=y&:showVizHome=n&:jsdebug=y&:bootstrapWhenNotified=y&:apiID=handler0

But i dont know how to generate unique-token

when i browse it on a website it shows token error

token error on browser

i used https:///trusted/ with username as param, but it always returns -1

im using trial version

Did this worked for anyone?

1

1 Answers

0
votes

It looks like you are trying to use Trusted Authentication but haven't done the steps necessary to create and use tokens. First, you need to configure Tableau Server to accept and trust requests from the server you will be embedding the dashboards in. Once you've done that you will be able to make POST requests for tokens from your web server. That is the time you use the username and other parameters. You will then receive a token that you can use to construct the URL for the view. Hope this helps!