Goal: Develop a web application using ArcGIS JavaScript API that has a single login experience for the end user and that enables them to edit feature layers hosted on Portal for ArcGIS.
Setup: We are using OpenText Coordys development environment. The GIS HTML Javascript application is in X-Form (Iframe) of the Coordys sytem. The web map consumed by the application from Portal for ArcGIS 10.5.1 and ArcGIS Server 10.5.1
The ArcGIS Enterprise environment is 10.5.1 (ArcGIS Server is federated and hosted) and exposed to internet using reverse proxy from organization. We are using ArcGIS JavaScript 3.23
The web map is shared only with a group and a technical user has the access to this group.
Whoever access the coordys application should be able to view the GIS map without asking authentication. The technical user is configured in Coordys to generate the token directly from portal and pas the token details to GIS map viewer with a service.
We are able to get the token before creating the map and utilized in Identity manager to register. However, while creating the map the error returned in JS and map is not creating.
The code is:
require([
"esri/map",
"esri/toolbars/navigation",
"esri/layers/FeatureLayer",
"esri/dijit/PopupTemplate",
"esri/InfoTemplate",
"esri/geometry/webMercatorUtils",
"esri/layers/FeatureLayer",
"esri/layers/LayerInfo",
"esri/urlUtils",
"esri/arcgis/utils",
"esri/layers/Field",
"esri/config",
"esri/tasks/GeometryService",
"esri/dijit/OverviewMap",
"esri/dijit/Legend",
"esri/dijit/LayerList",
"esri/dijit/Scalebar",
"esri/dijit/HomeButton",
"esri/dijit/Search",
"esri/dijit/BasemapGallery",
"esri/dijit/Basemap",
"esri/dijit/Measurement",
"esri/dijit/LocateButton",
"esri/geometry/Point",
"esri/SpatialReference",
"esri/IdentityManager"
],
function (Map, Navigation, FeatureLayer, PopupTemplate, InfoTemplate, webMercatorUtils, FeatureLayer, LayerInfo, urlUtils, arcgisUtils, Field, esriConfig, GeometryService, OverviewMap, Legend, LayerList, Scalebar, HomeButton, Search, BasemapGallery, Basemap, Measurement, LocateButton, Point, SpatialReference, esriId
) {
parser.parse();
var tokenProp = { expires: parseInt(globalPSObj.expires), server: Configs.portalurl + "/sharing/rest", ssl: globalPSObj.ssl, token: globalPSObj.Token, userId: globalPSObj.userId };
esriId. registerToken(tokenProp);
arcgisUtils.arcgisUrl = Configs.portalurl + "/sharing/content/items";
arcgisUtils.createMap(Configs.webmapid, "map").then(function (response) {
var map = response.map;
var ProjectRequests, Estimates, ProposedProjects, PR_Point;
}
});
Please advice the approach I am following is correct or what is the best way to implement this to by pass the user login.
Solved! Go to Solution.
Kishore, since you are using JS 3.23 the IdentityManager -registerToken method should have the server parameter as Portal URL only not a rest end url. Your syntax for JS 4.x
var tokenProp = { expires: parseInt(globalPSObj.expires), server: Configs.portalurl, ssl: globalPSObj.ssl, token: globalPSObj.Token, userId: globalPSObj.userId };
Kishore, since you are using JS 3.23 the IdentityManager -registerToken method should have the server parameter as Portal URL only not a rest end url. Your syntax for JS 4.x
var tokenProp = { expires: parseInt(globalPSObj.expires), server: Configs.portalurl, ssl: globalPSObj.ssl, token: globalPSObj.Token, userId: globalPSObj.userId };