AnsweredAssumed Answered

Passing Token to Service using ARCGIS JavaScript 4.0

Question asked by dcartistic on Sep 9, 2016
Latest reply on Sep 9, 2016 by endlessdsire

In my application, I'm trying to add a FeatureLayer to a map.  The FeatureLayer url requires a token, which is created when a user name and password are provided.  I don't want the user to have to enter the user name and password, so what I've done is create a method that sends the user name and password to our token service, which then returns the token.  I then pass the token to the FeatureLayer as follows:


var map = new Map({
basemap: "streets",

slider: false

var view = new MapView({
container: "viewDiv",
center: [-77.007308, 38.875827],
zoom: 18,
map: map


var supportFeatureLayer = new FeatureLayer({

url: + "?token=" + GISToken,
token: GISToken,

outFields: ["*"]




However, I still get a "Sign In" prompt, despite that I see data being returned by the REST service, using IE's developer tools.  I've attached a screenshot.  Is this the correct way to pass a token to a REST service?  Is there no way to prevent the "Sign In" prompt returned by the service?