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;
当我使用提取的数据源将我的工作簿发布到公共表时,它会起作用>
但是当我在带有实时数据源(sql)的tableau中发布相同内容时,
https:///#/ site / testsite / views / genderanalysis / Sheet2?:iid = 1
并且当我在这里使用时不起作用
并且从文档中,我发现具有唯一令牌的apihttps:// / 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
但是我不知道如何生成唯一令牌
当我在网站上浏览时显示令牌错误
我使用https:/// trusted /
,用户名作为参数,但始终返回-1正在使用试用版
这对任何人都有用吗?
import React,{组件} from'react';从'tableau-api'导入tableau;类App扩展了组件{componentDidMount(){this.initViz()} initViz(){const vizUrl ...
似乎您正在尝试使用Trusted Authentication,但尚未完成创建和使用令牌的必要步骤。首先,您需要configure Tableau Server接受并信任来自服务器的请求,您将在其中嵌入仪表板。完成后,您将可以从Web服务器中make POST requests for tokens。那是您使用username
和其他参数的时间。然后,您将收到一个令牌,可用于构建视图的URL。希望这会有所帮助!