Token based authentication in visualize.js

This is my visualize.js code for token based authentication, but it doesn"t work, please some one can help me to solve this???

 

<script type="text/javascript">
 
var authToken = encodeURIComponent("u=prabhath|r=role|o=EMEA|pa1=Sweden");
visualize.config({
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);
});
 
</script>
anuradhe.prabhath's picture
Joined: Nov 13 2015 - 2:30am
Last seen: 7 years 2 weeks ago

Hi,

Thanks for the reply. I realized my code is ok. wrong is I didn"t configure the jasperserver correctly to the token based authentication. thank you for your reply :)

anuradhe.prabhath - 7 years 3 months ago

1 Answer:

Are you getting an error? Can you see the /auth call being made in your browser console?

 

Our token auth looks a little different than yours:

 

            visualize({

                auth: {
                    token: theToken,
                    tokenName: "ticket"
                }
            }, function(v){
                _reportService = v;
                _exportFormats = v.report.exportFormats;

            }, function(err){
                _handleError("An error occurred while attempting to connect to the reporting service. " + err.message, err);
            });

jclarke_1's picture
467
Joined: Feb 9 2015 - 9:09am
Last seen: 6 years 1 month ago
Feedback
randomness