Esri / esri-loader

A tiny library to help load ArcGIS API for JavaScript modules in non-Dojo applications
Apache License 2.0
457 stars 79 forks source link

How to use private service #176

Closed abhishekhingu closed 4 years ago

abhishekhingu commented 5 years ago
andygup commented 5 years ago

@abhishekhingu did you run into some errors? I'm assuming you are referring to ArcGIS hosted secure services?

Here's some documentation on working with secured services and the ArcGIS API for JavaScript https://developers.arcgis.com/javascript/latest/guide/secure-resources/

tomwayson commented 5 years ago

One way to do this is use esri-loader to load the ArcGIS API modules for working w/ identity (like esri/identity/IdentityManager and esri/identity/OAuthInfo) as described in the link that @andygup shared above. You would then use those modules to register a token w/ the ArcGIS API before loading the secure layers. This works fine if you only need to work w/ the secure layers when you are going to show the map.

Alternatively if you want users to be able to log in or work w/ the secure layers even when you are not showing a map (i.e. show layer data in a table, etc), you can use arcgis-rest-js to generate the token and/or query the layer data. Then when you are ready to show a map, you can register the token you generated w/ arcgis-rest-js with the ArcGIS API as shown in this demo.

Biboba commented 5 years ago

Very interesting answer @tomwayson, thanks !

I have also another use case to access secured resources from an ArcGIS Enterprise secured with SAML and I was not able to find any solution so far: I have an application secured with the very same SAML identify provider and I would like to automatically authenticate the user on this ArcGIS Enterprise without the prompting oauth window so that the map get diplayed without any additional authenticating steps.

Any idea/library/sample you would recommend ?

Many thanks

tomwayson commented 5 years ago

I'm not personally familiar w/ any such sample, but that's not saying much, I've rarely had to work w/ a SAML provider.

tomwayson commented 4 years ago

closing due to inactivity