AnsweredAssumed Answered

How do I Pass Token to Secure Service using ARCGIS JavaScript 4.x

Question asked by xtiaan28 on May 5, 2020
Latest reply on May 5, 2020 by odoe

Hi all, I'm trying to pass a token to a secure FeatureLayer like this:


var clientLayer = new FeatureLayer({
    url: "https://xxxxxxx/MapServer/0?token="+token,
    outFields: ["*"]


Then I Get :

I also using these methods to get the token:


var def = esriId.generateToken(serverInfo, {
        "username": usuario,
        "password": pass,
        "referer": document.URL
      def.then(function (value) {
        token = value.token;
          server : server,
          token : token,
          expires : 90

So, How is the correct way to pass the token to secure layer?