title: Token based authentication to Jasper reports failing when used with visualize.js
body: <p>I am using Jasper 6.1 and configured my server to allow token based authentication. It works fine when i use token to login from browser. With the valid token, I am able to get into the system without entering username and password.</p>
  
  <p>Now, I am integrating it with visualize.js in order to show reports on our application's web page. Below is request call :-</p>
  
  <pre><code>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);
  });
  </code></pre>
  
  <p>However, on successful authentication it is not redirecting to success url but returning the below html with HTTP code 200. Due to which the Authentication is failing with the error message as "Unexpected token &lt;".</p>
  
  <p>Appreciate any help on this.</p>
  
  <p></p>
  
  <pre><code>&lt;head&gt;
  &lt;title&gt;&lt;/title&gt;
  &lt;meta http-equiv="refresh" content="0;url=home.html"&gt;
  &lt;script language="javascript" type="text/javascript"&gt;
  window.location="home.html";
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  If your browser doesn't automatically go there,
  you may want to go to &lt;a href="home.html"&gt;the destination&lt;/a&gt;
  manually.
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>