Visualize.js authentication error after second login

0

I have a website—utilizing Visualize.js—that has a simple login/logout feature. Everytime I login I call

the authenticateUser() and logout destroySession() method. When I try login and then logout and then login again, when I

try to render my existing reports I get this thrown error:

 

HTTP Status 401 - Full authentication is required to access this resource

The functions authenicateUser() and destroySession() are shown below:

function authenticateUser () {
    var myConfig = {
        auth : {
            name     : "superuser",
            password : "superuser"
        }
    };
    visualize.config( myConfig );
}
 
function destroySession() {
    visualize( function ( v ) {
        // Logout form JRS and finish the session.
        v.logout().done( function () {
        } );
    } )
}

I would like to point out that when I first login my account this error is not thrown and renders the reports perfectly.

Why is this happening after logout and then login again?

ry_15_yan's picture
Joined: May 31 2015 - 6:22pm
Last seen: 4 years 1 month ago

2 Answers:

0
ry_15_yan's picture
Joined: May 31 2015 - 6:22pm
Last seen: 4 years 1 month ago
0

I'm not 100% sure about this but from playing around with visualize in my own app it seems that config doesn't actually make the REST call to the server for the authentication, but only sets up the credentials for when another visualize function is called, which is useful for running multiple containers with shared credentials. To troubleshoot you may want to try just the simple authentication methods shown in the cookbook and work up from there.

srang's picture
206
Joined: Oct 28 2014 - 11:52am
Last seen: 3 years 1 month ago
Feedback