我正在使用 Jasper 6.1 并将我的服务器配置为允许基于令牌的身份验证。当我使用令牌从浏览器登录时它工作正常。使用有效令牌,我无需输入用户名和密码即可进入系统。
现在,我将它与 Visualize.js 集成,以便在我们的应用程序网页上显示报告。以下是请求电话:-
var authToken = encodeURIComponent("u=jsmith|r=admin|exp=20150831172506-0800|t=ABC");
visualize.config({
server: "http://localhost:8080/jasperserver-pro",
scripts: "optimized-scripts",
logEnabled: true,
logLevel: "error",
auth: {
token: authToken,
preAuth: true,
tokenName: "pp"
}}, function (v) {
$scope.v = v;
$scope.reportingInitialized = true;
$scope.$digest();
}, function (err) {
alert("Auth error! Server said: " + err.message);
});
但是,在成功验证时,它不会重定向到成功 url,而是返回带有 HTTP 代码 200 的以下 html。因此,验证失败,错误消息为“意外令牌 <”。
感谢您对此的任何帮助。
<head>
<title></title>
<meta http-equiv="refresh" content="0;url=home.html">
<script language="javascript" type="text/javascript">
window.location="home.html";
</script>
</head>
<body>
If your browser doesn't automatically go there,
you may want to go to <a href="home.html">the destination</a>
manually.
</body>
</html>