Jump to content

Authentication error / Refresh credentials? Visualize.JS


Recommended Posts

Hello there,

We are currently using Visualize.JS to display charts and tabular data inside our application. At the moment, we are using plan basic authentication for testing purposes.
Sometimes, after using it a while or leaving the computer on and coming back... we get this message in the console:
[Error] Failed to load resource: the server responded with a status of 401 (Unauthorized) (reportExecutions, line 0)
[Error] 11:28:16.38 [bi/component/Report] [ERROR] - authentication.error : Authentication error
When this happens we do not get any output. Is there any way to detect this and authenticate "again"? Because when I try to do so it does not work. It looks like the only way possible to make it authenticate again is to clean the browser cache.
Any ideas?
Thanks in advance.
Link to comment
Share on other sites

  • 2 months later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

In case you're still looking for an idea on this...

We were experiencing a similar issue in which these 401 statuses would be returned after a period of inactivity in our application (we're embedding reports using Visualize.js). Attempting to run any reports, even with the authentication username / password included every time, continued to return 401. A page refresh fixed the issue, however. We were able to catch and attempt to handle this with the error handler attached to the v.report({}) function.

It appears that some of the session information is actually stored within the visualize.js script that you pull from the server before executing any reports. We found the following steps fix this issue (and can be done behind the scenes without refreshing the page or alerting the user):

  1. Catch and handle the authentication error. Set window.visualize = null.
  2. Fetch the visualize.js script from your JasperReports Server again.
  3. Execute the report again.

These steps have effectively resolved our issue, though I suspect that there may be a more proper solution out there if anyone has better knowledge of the visualize.js source code and knows how this session information is stored.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...