Experience builder Embed widget - embedding ArcGIS JSAPI code and accessing secured AGOL content?

433
2
06-30-2020 04:30 AM
AlexBriggs1
New Contributor II

Is it possible to use the JSAPI within the embed widget to access secured content? It is working with public content, but when I try to use OAuth to access secured content the IdentityManager throws an error :

The idea is to use the JSAPI to use custom sliders to interact with a map, but the map layers must be secured. The experience will be secured in the same way as the content, so was hoping the embed code could inherit the user creds from the experience and access the content, adhering to the named user model!

Is it possible to do this sort of thing?

2 Replies
RyanDickinson1
New Contributor III

Alex,

You should be able to add "esri/config", esriConfig.

You then set your portal url esri.portUrl = "https://yourdomain.com/portal".

You should then have access to all of the secure items you're looking for, granted your account has permission to view the item's rest json (which you can find in your dev tools network) ie "https://yourdomain.com/portal/sharing/rest/content/items/itemId?f=json".

RyanDickinson1
New Contributor III

Also, you can OAuthInfo and IdentityManager. Step by step here:

https://developers.arcgis.com/javascript/latest/sample-code/identity-oauth-basic/

0 Kudos