第二次登录后Visualize.js身份验证错误 [英] Visualize.js authentication error after second login

查看:99
本文介绍了第二次登录后Visualize.js身份验证错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网站 - 利用 Visualize.js - 它具有简单的登录/注销功能。我每次登录时都会调用 authenicateUser()函数并注销 destroySession()。当我尝试登录然后注销然后再次登录时,当我尝试渲染我现有的报告时,我得到了这个抛出的错误:

I have a website—utilizing Visualize.js—that has a simple login/logout feature. Everytime I login I call the authenicateUser() function and logout destroySession(). 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

函数 authenicateUser () destroySession()如下所示:

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?

推荐答案

这似乎对我有用。所以我首先调用visualize.config(config),以便我可以存储公共配置,在可视化调用之间共享它们,然后调用login方法,以便我可以使用提供的auth对象执行身份验证。我的参考: http://community.jaspersoft.com/wiki/ visualizejs-api-notes-and-samples-v56

This seemed to have worked for me. So I called visualize.config( config ) first so that I can store common configuration, to share them between visualize calls and then called the login method so that I can perform authentification with provided auth object. My reference: http://community.jaspersoft.com/wiki/visualizejs-api-notes-and-samples-v56

        visualize.config( config );
        visualize( function ( v ) {
            v.login( config );
        } );

虽然这个解决方案不在他们的文档中,但是我把它们一块一块地放在最后解决问题。

This solution was not in their documentation though, but I put them piece by piece to finally solve the problem.

这篇关于第二次登录后Visualize.js身份验证错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆