Avoid login popup

579
1
07-03-2021 09:33 AM
jkumartry1980
New Contributor II

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
});

 

 

jkumartry1980_0-1625329943265.png

 

Best Regards,

K.Jayakumar

0 Kudos
1 Reply
JethroLeevers
New Contributor III

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)

IdentityManager.registerToken(authInfo);

 

Regards,

Jethro

0 Kudos