Hi All,
I am using custom base map into my application , but the application is prompting to enter the credentials. I want avoid the login window and pass the credentials in the code itself. Kindly suggest me the idea.
var baseMapLayer = new TileLayer({
url: <basemap URL>
});
const customBasemap = new Basemap({
baseLayers: [baseMapLayer]
});
map = new Map({
basemap: customBasemap
});
Best Regards,
K.Jayakumar
Hi K,
I would suggest using a token in your code, you could use a proxy to call the generateToken rest endpoint on a portal.
https://developers.arcgis.com/rest/users-groups-and-items/generate-token.htm
You can then use this with the IdentityManager class (https://developers.arcgis.com/javascript/latest/api-reference/esri-identity-IdentityManager.html)
Regards,
Jethro
hi JethroLeevers, by your method, i can avoid the login popup window. but in my app i am loading a imagelayer https://env1.arcgis.com/arcgis/rest/services/Sentinel2_10m_LandCover/ImageServer
the token will cause the layer cannot be loaded and gives a invalid token error.
this layer is a public access resource.
how to solve this problem?