esriId.registerToken is not a function

2221
1
Jump to solution
08-17-2017 04:50 AM
KostasPapakonstantinou
New Contributor

Hello,

I try to register a token I have created, using IdentityManager.registerToken()

as it is suggested in MapImageLayer | API Reference | ArcGIS API for JavaScript 4.4 and

IdentityManager | API Reference | ArcGIS API for JavaScript 4.4 

but i get the error, in console , "esriId.registerToken is not a function". What's wrong?

thank you,
Kostas

...
var esriRequireModules = [
    "esri/Map",
    "esri/request",
    "esri/geometry/support/webMercatorUtils",
    "esri/geometry/Point",
    "esri/widgets/Search",
    "esri/Graphic",
    "esri/symbols/PictureMarkerSymbol",
    "esri/PopupTemplate",
    "esri/layers/GraphicsLayer",
    "esri/layers/FeatureLayer",
    "esri/layers/MapImageLayer",
    "esri/layers/GroupLayer",
    "dojo/on",
    "dojo/domReady!",
    "esri/identity/IdentityManager"
];

var esriRequireCallback = function(
    Map,
    esriRequest,
    webMercatorUtils,
    Point,
    Search,
    Graphic,
    PictureMarkerSymbol,
    PopupTemplate,
    GraphicsLayer,
    FeatureLayer,
    MapImageLayer,
    GroupLayer,
    on,
    esriId
) {

...

esriId.registerToken({
    server : ...
    token : ...
    expires : ...
});

...

};

esriLoader.require(esriRequireModules, esriRequireCallback);

 
0 Kudos
1 Solution

Accepted Solutions
roemhildtg
Occasional Contributor III

Your module paths and module variables need to appear in the same order. 

var esriRequireModules = [
    "esri/Map", // 0
    "esri/request", // 1
    "esri/geometry/support/webMercatorUtils", //2
    "esri/geometry/Point", //3
    "esri/widgets/Search",//4
    "esri/Graphic",//5
    "esri/symbols/PictureMarkerSymbol",//6
    "esri/PopupTemplate",//7
    "esri/layers/GraphicsLayer",//8
    "esri/layers/FeatureLayer",//9
    "esri/layers/MapImageLayer",//10
    "esri/layers/GroupLayer",//11
    "dojo/on",//12
    "dojo/domReady!",//13
    "esri/identity/IdentityManager"//14
];

var esriRequireCallback = function(
    Map,//0
    esriRequest,//1
    webMercatorUtils,//2
    Point,//3
    Search,//4
    Graphic,//5
    PictureMarkerSymbol,//6
    PopupTemplate,//7
    GraphicsLayer,//8
    FeatureLayer,//9
    MapImageLayer,//10
    GroupLayer,//11
    on,//12
    esriId‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍//13‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

So in your case, esriId is actually the domReady object. you can switch the two paths in your require array, or add another variable in your callback to fix. 

View solution in original post

1 Reply
roemhildtg
Occasional Contributor III

Your module paths and module variables need to appear in the same order. 

var esriRequireModules = [
    "esri/Map", // 0
    "esri/request", // 1
    "esri/geometry/support/webMercatorUtils", //2
    "esri/geometry/Point", //3
    "esri/widgets/Search",//4
    "esri/Graphic",//5
    "esri/symbols/PictureMarkerSymbol",//6
    "esri/PopupTemplate",//7
    "esri/layers/GraphicsLayer",//8
    "esri/layers/FeatureLayer",//9
    "esri/layers/MapImageLayer",//10
    "esri/layers/GroupLayer",//11
    "dojo/on",//12
    "dojo/domReady!",//13
    "esri/identity/IdentityManager"//14
];

var esriRequireCallback = function(
    Map,//0
    esriRequest,//1
    webMercatorUtils,//2
    Point,//3
    Search,//4
    Graphic,//5
    PictureMarkerSymbol,//6
    PopupTemplate,//7
    GraphicsLayer,//8
    FeatureLayer,//9
    MapImageLayer,//10
    GroupLayer,//11
    on,//12
    esriId‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍//13‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

So in your case, esriId is actually the domReady object. you can switch the two paths in your require array, or add another variable in your callback to fix.