¿Cómo puedo conectarme a la nueva Layer (My data) que está en el modo privet me desde mi código javascript? Me pidió el Nombre de usuario y la contraseña, intenté con la contraseña de mi Acount pero no funcionó. ¿También hay alguna forma de agregar el nombre de usuario y la contraseña al final de la URL del servicio en el script jason? <\/P>
como: <\/P>
https:\/\/services7.arcgis.com\/vmdU9JnBFQEei09w\/arcgis\/rest\/services\/trailheads\/FeatureServer<\/A> \/user\/pass<\/P><\/BODY><\/HTML>
Here's a tip for troubleshooting which layer might be causing your problem with the login window:
https://community.esri.com/people/jbarry-esristaff/blog/2020/04/08/tip-load-layers-using-portal-item-id-versus-rest-endpoint-uri
If you are creating a web application using the ArcGIS API for JavaScript, and you try to load a layer that has its sharing level set to "Owner", then yes, when you load that page, the API will try to load that layer; it will find that the sharing level is Owner and will open a login popup for you to login with. As long as the username and password are the same account that the layer is owned by, the layer will load after correct login.
We understand that you tried this, and it still failed to load. This would require just a little bit more troubleshooting. It's possible that the login popup you're getting is for some other resource in your app that is not shared with your account that you logged in with. If you comment out the loading of that layer, and you are still getting that login popup, that would help narrow it down. The idea here is to keep testing until you find the layer that is failing to load, then you can adjust (or request to adjust) the sharing level of that resource. We would recommend you comment out all ArcGIS Online resources, then commenting them back in one at a time, or in groups, in order to find those resources that are opening the login modal and why.
In most cases, that should solve the problem.
We see that you're also asking a question about how to make a private, un-shared layer visible inside your application without requiring user login. There are a few techniques for keeping resources private, and still exposing them to selected applications. One way is to use a proxy. See this document for more information. Go to this page and scroll down to the section called "Application logins". https://developers.arcgis.com/javascript/latest/guide/secure-resources/Using a proxy is a secure and supported way to accomplish this. It is not recommended to pass your login name and password credentials to the app/page as URL parameters in the clear. If you have difficulties or questions in setting this up, please contact Technical Support.
Also, we have a GeoNet community forum specifically for the ArcGIS API for JavaScript. The global community of folks using that API use that forum for Q&A. You will find the best answers and quickest replies there. https://community.esri.com/community/developers/web-developers/arcgis-api-for-javascript/content
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.