I have multiple feature layers being hosted on my account (share setting is set to owner). I cannot see any of the layers. I have implemented the esriConfig.apikey into my code but I'm not able to access the layers
@JeffreyWilkerson
Hi @TheGamer -
Sounds like you have an ArcGIS Online account and API keys cannot be used to access secure content with this account type. This is outlined in the note section: https://developers.arcgis.com/documentation/mapping-apis-and-services/security/api-keys/#access-content-and-items
That means you must use OAuth 2.0 to authenticate your application with user logins to access your secure data. Here's the JS API documentation on how to implement this with OAuth 2.0: https://developers.arcgis.com/javascript/latest/secure-resources/#user-logins
The OAuth information needs to be registered with the IdentityManager in your application. Here's a sample showing how to set up this workflow: https://developers.arcgis.com/javascript/latest/sample-code/identity-oauth-basic/
Hi @LaurenBoyd when I got to Content and Items its asking me to create an application with OAuth2.0. I created the application but I'm not sure what to do next
Did you configure your API key to access those layers or webmap? This needs to be done explicitly in the API key settings. Here is the documentation outlining the details on accessing layers and webmaps via API keys: https://developers.arcgis.com/documentation/mapping-apis-and-services/security/api-keys/#access-content-and-items
There is also a tutorial that shows you how to configure your API key to access specific data: https://developers.arcgis.com/documentation/mapping-apis-and-services/security/tutorials/create-and-manage-an-api-key/#content-and-items
Hope this helps!
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.