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

905
4
06-30-2020 04:30 AM
by Anonymous User
Not applicable

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?

4 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
ZachPorteous
New Contributor III

Hello, were you ever able to figure this out with the Embed widget in Exp Builder? Need access to secure services without a UN PW log in prompt but I have not been able to get the redirect uri right - I would not be surprised if it is not possible. 

They also just changed it to 8kb so it wont be useful at all anymore, but we are still on 10.8. 

0 Kudos
ZachPorteous
New Contributor III

@UndralBatsukh do you know if this is possible and if so how to set the redirect uri? 

0 Kudos