AnsweredAssumed Answered

How to log in with token srv

Question asked by endlessdsire on May 9, 2015
Latest reply on May 11, 2015 by rscheitlin

Hello,

Im trying to find some code to add to my app for logging in with tokens using a userid and pass for default but i dont know how to do it.

How can i do that using my code?

 

I have the following:

var map;


var dominio = "vialactea";
        var sl = new String('\\');
        var usuario = "ehernanr";
        var userid = dominio + sl + usuario;
        var pass = 'chilquinta5';
       
    require([
      "dojo/dom-construct",
      "esri/Color",
      "esri/dijit/Geocoder",
      "esri/dijit/Popup",
      "esri/InfoTemplate",
      "esri/layers/ArcGISDynamicMapServiceLayer",
      "esri/map",
      "esri/symbols/SimpleFillSymbol",
      "esri/symbols/SimpleLineSymbol", "dojo/domReady!",
      "esri/IdentityManager", 
     "esri/ServerInfo", 
      "esri/Credential", 
     "esri/request"
    ], function(
      domConstruct, Color, Geocoder, Popup, InfoTemplate,
      ArcGISDynamicMapServiceLayer, Map, SimpleFillSymbol, SimpleLineSymbol, idManager, ServerInfo, Credential, esriRequest
    ) {
      var sls = new SimpleLineSymbol("solid", new Color("#444444"), 3);
      var sfs = new SimpleFillSymbol("solid", sls, new Color([68, 68, 68, 0.25]));


      var popup = new Popup({
        fillSymbol: sfs,
        lineSymbol: null,
        markerSymbol: null
      }, domConstruct.create("div"));
     
     


      map = new Map("map", {
        basemap: "topo",
        center: [-71.0659,-32.9252], // long, lat
        zoom: 8,
        sliderStyle: "small",
        infoWindow: popup
      });
     
     
  
       //AÑADIR MAPSERVER
       var chqMapServer = new ArcGISDynamicMapServiceLayer(".../PMS/Concesiones/MapServer", { 
        "id": "concesiones", 
        "opacity": 0.75 
        });
       
        //TEMPLATE PARA MOSTRAR INFOWINDOW SSEE (0)
     var trans = new InfoTemplate();
        trans.setTitle("<b>ID: ${concesion_id}</b>");
      
        var transInfoContent =
        "<div style=padding-top: 10px;>Clase: ${clase}<br></div>" +
        "<div style=display:inline-block;width:8px;></div>";
       
        trans.setContent(transInfoContent);
       
         //TEMPLATE PARA MOSTRAR INFOWINDOW SSEE (1)
     var dist = new InfoTemplate();
        dist.setTitle("<b>ID: ${concesion_id}</b>");
      
        var distInfoContent =
        "<div style=padding-top: 10px;>Clase: ${clase}<br></div>" +
        "<div style=display:inline-block;width:8px;></div>";
       
        dist.setContent(distInfoContent);
       
        //Añadiendo Templates al MapServer
         chqMapServer.setInfoTemplates({ 
         0:{  infoTemplate: trans},
         1:{  infoTemplate: dist }
         }); 
       
         //Agregando la capa al mapa
  map.addLayer(chqMapServer);

  
  var chqMapServer2 = new ArcGISDynamicMapServiceLayer("...PMS/Electricidad/MapServer", { 
        "id": "electricidad", 
        "opacity": 0.75 
        });
       
         //TEMPLATE PARA MOSTRAR INFOWINDOW SSEE (1)
     var dist = new InfoTemplate();
        dist.setTitle("<b>ID: ${id_tramo}</b>");
      
        var distInfoContent =
        "<div style=padding-top: 10px;>Sed: ${sed}<br></div>" +
        "<div style=display:inline-block;width:8px;></div>";
       
        dist.setContent(distInfoContent);
       
  //Añadiendo Templates al MapServer
         chqMapServer2.setInfoTemplates({ 
         2:{ infoTemplate: dist}
         });         
  map.addLayer(chqMapServer2);
    
});

 

 

Thanks for all ur help as always !

Outcomes