AnsweredAssumed Answered

How to request a layer with a token in the Javascript API 4.x?

Question asked by mdurans on Apr 6, 2017
Latest reply on Apr 7, 2017 by mdurans

Help please!


I am trying add a layer to a map using the JS API 4.x. This layer is a feature layer and it has a token to access to it.

In the Esri Javascipt I was add the layer just by specifying the token in the URL.

I am trying to do the same in 4.x however the app is always asking me for a user and password even if I already attached a valid token to the URL.


var myUrl = '';
var token = 'xioxioxioxioxioxioxioxioxio............'
var featureLayer = new FeatureLayer({
url: myURL + "?token=" + token


Is there a new way to do this in 4.x? 


I am attaching the code of the app and also an screenshot. Thank you very much!