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.
- ArcGISAuthError
- code: 499
- message: "499: Token Required"
- name: "ArcGISAuthError"
- options: {httpMethod: "GET", params: {…}, headers: {…}, fetch: ƒ}
- originalMessage: "Token Required"
- response: {error: {…}}
- url: "https://myUrl.memphistn.gov/arcgis/rest/services/PORT_Construction_Inspection/ENG_CI_SERVICE_REQUEST..."
- __proto__: ArcGISRequestError