Jump to content
Changes to the Jaspersoft community edition download ×

How to log into visualize.js when token authentication is only permitted through the headers?


barry.hutchison

Recommended Posts

I have enabled token authentication on my server (6.2.1) and only want to permit the token to be passed through the headers NOT URL.  How do I then login to visualize.js?  Since the auth object of visualize.js seems to pass the auth object token property to the URL.  

visualize({    server: window.location.origin + '/jasperserver-pro',    auth: {        token: token,        preAuth: true,        tokenName: "pp"    }}[/code]

The above doesn't work.  There is a headers property in the documentation but the syntax isn't clear I was hoping someone could point me in the right direction.

 

Cheers

Link to comment
Share on other sites

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

Top Posters In This Topic

Top Posters In This Topic

To pass token in request header , you have to use loginFn of visualize.js:

visualize({
            auth: {
                    preAuth: true,
                    token:token,
                    loginFn:function(properties,request){
                        return request({
                            url:<URL of jasper report server>,
                            type:"get",
                            headers:{"pp":properties.token,"Accept":"application/json"}
                        });
                    }
                   }

 

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...