Hello,
I'm developing angular/ruby on rails web application. For arcgis we are using javascript api. Is it possible to access private layers hosted on arcgis online with app id.
Layer.fromPortalItem({ portalItem: { // autocasts new PortalItem() id: "8444e275037549c1acab02d2626daaee" } }).then(function(layer){ // add the layer to the map map.add(layer); });
Hi Rudy, absolutely. See this page on app logins and using a proxy:
https://developers.arcgis.com/documentation/core-concepts/security-and-authentication/#app-login
Hello Noah,
Thanks for reply. Do you have some sample code? Can I login using proxy?
This is stated in documentation:
App login can be used to access any of these services:
There are certain limitations and restrictions using app login.
Capability | App login[3] | Named user login [1] |
---|---|---|
Geocoding | ✓ | ✓ [2] |
Routing | ✓ | ✓ [2] |
Demographic data | ✓ | ✓ [2] |
Premium layers and imagery | ✓ | ✓ [2] |
Elevation analysis | ✓ | ✓ [2] |
Spatial analysis | ✓ [2] | |
Read public content | ✓ | ✓ |
Read content owned by user | ✓ | |
Read content shared with user | ✓ [2] | |
Create/update/delete user's content | ✓ | |
Create/update/delete shared content | ✓ [2] | |
Share content with other users | ✓ [2] |
[1] Usage (if any) billed to a user's organization.
Hmmm, I guess you're not allowed to app logins for private layers/services. Well, you're certainly allowed to use the Esri resource proxy for this use case.
Thanks I intend to try this. Can printtask service work with layers that go trough proxy?
Yes, this should work fine. You may need to host your own printing service though.
We managed to access protected layer using arcgis toke, it is easier to use than proxy.
Can printing service be used with Arcgis online developer account.
It seams that print service is not working properly for examples, they are failing to generate print
https://developers.arcgis.com/javascript/latest/sample-code/widgets-print/index.html