Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 4089

How to add Authorization Header while accessing JSON in D3

$
0
0

I am working on D3 graphs to build some Interactive Dashboard. I can able to integrate graphs using static JSON. Now I want to get JSON from my running Server. My server needs some kind of basic Authorization.

I can able to get XML Response in Restclient after adding Basic Authentication Header. but in D3 it is not working.

My D3 is looking like this ...

d3.json("http://localhost:9001/***/rest/products", function(error, root) {   var node = svg1.selectAll(".node")  .data(bubble.nodes(classes(root))  .filter(function(d) { return !d.children; })).enter().append("g")  .attr("class", "node")  .attr("transform", function(d) { return "translate("+ d.x +","+ d.y +")"; });   node.append("title")     .text(function(d) { return d.className +": "+ format(d.value); });   node.append("circle")    .attr("r", function(d) { return d.r; })    .style("fill", function(d) { return color(d.packageName); });   node.append("text")    .attr("dy", ".3em")    .style("text-anchor", "middle")    .text(function(d) { return d.className.substring(0, d.r / 3); }); });

It will give 403 Forbidden error because Here I have not added Authentication header.

How can I add authentication header in D3.json so that I can access my resource in JSON form without any permission denied problem.


Viewing all articles
Browse latest Browse all 4089

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>