How can I access MODIS map service from configurable map viewer ?

Here is my code from viewer.js :

var token = 'OvKOMsp8IMRZE5E0FbtsmLx-nUMulBrbukj_1w-i_F-Taxpx5wwC3C7ZcufAsOiA-gV-c3-DiG44e1ozQyAifAwd48Pq00azDvL8Fn7jqRms2CX1LHi-fHKHyyTamvaKXQlVt8cBP0vBTnXT3QpihaJBxjOLB4sPS88oWbqYHP4h-x-bMYOweQVhOUIxuLTWmxi4yXvdDsS_oiYeMA_krW6YWnSTvkJQkFqMGq79ZDo..';

type: 'dynamic', url: 'https://livefeeds.arcgis.com/arcgis/rest/services/LiveFeeds/MODIS_Thermal/MapServer?token=' + token, title: 'HotSpot MODIS (Last 24 hours)', options: { id: 'hotspot_esri_modis_thermal', opacity: 0.8, visible: true, imageParameters: imageParameters }, identifyLayerInfos: { layerIds: [0] }, legendLayerInfos: { layerInfo: { //hideLayers: [21] } }, layerControlLayerInfos: { swipe: true, metadataUrl: true, expanded: true } }

It wont appear on the map. It seems that it needs some sort of authentication. But when I call directly on the browser, the description appears but still cant be viewed :


I even tried generating the token using cl_id and cl_secret using my free AGOL account and pass the token to viewer,js :

<script src=""> </script>
var settings = {
    "async": false,
    "crossDomain": true,
    "url": "https://www.arcgis.com/sharing/rest/oauth2/token",
    "method": "POST",
    "headers": {
      "content-type": "application/x-www-form-urlencoded",
      "accept": "application/json"
    "data": {
      "client_id": "p2sHE9KdRAEvSzAI",
      "client_secret": "d5313f1d40f04c009bfde1afc180d7d0",
      "grant_type": "client_credentials",

  $.ajax(settings).done(function (response) {

    var token2 = response; 
    var token3 = JSON.parse(token2);
    var token4 = token3.access_token;

    var apptoken = document.getElementById("UserToken");
    apptoken.innerHTML = token4;


url: 'https://livefeeds.arcgis.com/arcgis/rest/services/LiveFeeds/MODIS_Thermal/MapServer?token=' + token,

Still the map wont appear although the layer is listed on the layer list.

Any advice ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.