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

529
0
05-14-2020 10:36 PM
Labels (1)
by Anonymous User
Not applicable

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/MapSe..."

 

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" })
.datasets(datasets)
.series(series)
.overrides(style);
// render the chart
chart.show();

 

 

 

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: "https://myUrl.memphistn.gov/arcgis/rest/services/PORT_Construction_Inspection/ENG_CI_SERVICE_REQUEST..."
    8. __proto__: ArcGISRequestError
0 Kudos
0 Replies