AnsweredAssumed Answered

How to pass a token with a Url in cedar Charts in leaflet.

Question asked by muralidharmoka on May 14, 2020

Passing a token in cedar charts.


Hi , I am trying to pass a token with my rest service Url into a dataset for drawing a cedar chart.


Here is the code.



var serviceurl = "https://myCompanyUrl/arcgis/rest/services/PORT_Construction_Inspection/ENG_CI_SERVICE_REQUESTS/MapServer/0"


var datasets = [{
   "url": serviceurl,
   "token": sessionStorage.getItem("token"),  //Here where I am passing the token
   "name": "ServiceRequests",
   "query": {
   "orderByFields": "Number_of_SUM DESC",
   "groupByFieldsForStatistics": "REQUEST_STATUS",
   "outStatistics": [{
   "statisticType": "count",
   "onStatisticField": "OBJECTID",
   "outStatisticFieldName": "Number_of_SUM"


// designate a one or more series to show the data on the chart
var series = [{
"category": { "field": "REQUEST_STATUS", "label": "Status" },
"value": { "field": "Number_of_SUM", "label": "Count" },
"source": "ServiceRequests"

// optionally override any of the cart type's default styles
var overrides = {
"categoryAxis": {
"labelRotation": 0

//create a cedar chart using the known 'bar' type
var elementId = 'chart';

var chart = new cedar.Chart(elementId, { "type": "bar-horizontal" })
// render the chart;




Here is my error. When I look at the Url below, I do not see the token concatenation. Is there a different way to pass a token.

  1. ArcGISAuthError
    1. code: 499
    2. message: "499: Token Required"
    3. name: "ArcGISAuthError"
    4. options: {httpMethod: "GET", params: {…}, headers: {…}, fetch: ƒ}
    5. originalMessage: "Token Required"
    6. response: {error: {…}}
    7. url: "*&sqlFormat=standard&orderByFields=SUPERVISOR_ZONE%20ASC&groupByFieldsForStatistics=SUPERVISOR_ZONE&outStatistics=%5B%7B%22statisticType%22%3A%22count%22%2C%22onStatisticField%22%3A%22OBJECTID%22%2C%22outStatisticFieldName%22%3A%22Number_of_SUM%22%7D%5D"
    8. __proto__: ArcGISRequestError