arcgis-maps-sdk-swift-samples
arcgis-maps-sdk-swift-samples copied to clipboard
ArcGIS Maps SDK invalid API Key Error
I created an API key with all the privileges and added it to the .secrets file. But I still get the error
ArcGIS Maps SDK invalid API Key Error: The API key '*j9CKE' is invalid, expired, or does not have access to the resource 'https://basemapstyles-api.arcgis.com/arcgis/rest/services/styles/v2/webmaps/arcgis/dark-gray'. Please visit https://developers.arcgis.com/api-keys to configure the API key to access the resource, or to create a new API key.
Is there anything I forgot?
Device: iPad (10th Gen) iPadOS 17.3.1 Xcode 15.4
Thanks for asking the question. If you have configured the privileges correctly, it should just work so I'm not sure what's up here. 🤔
Do you have an Esri Community account? You can sign up and ping me via DM and we can try to figure it out there.
If you have a key that is known to be working for other applications, try that and compare result.
@pixlhero You can refer to this post, it also works for me. https://community.esri.com/t5/net-maps-sdk-questions/wpf-app-with-api-key-not-working/m-p/1516657
@pixlhero You can refer to this post, it also works for me. https://community.esri.com/t5/net-maps-sdk-questions/wpf-app-with-api-key-not-working/m-p/1516657
That wasn't the issue, but thanks.
ArcGIS Maps SDK invalid API Key Error: The API key '*j2Qde' is invalid, expired, or does not have access to the resource 'https://basemapstyles-api.arcgis.com/arcgis/rest/services/styles/v2/webmaps/arcgis/oceans'. Please visit https://developers.arcgis.com/api-keys to configure the API key to access the resource, or to create a new API key. Is there anything I forgot?
Device: iphone 15 pro (17.5) Xcode 15.4 SPM : 200.5.1
ArcGIS Maps SDK invalid API Key Error: The API key '*j2Qde' is invalid, expired, or does not have access to the resource 'https://basemapstyles-api.arcgis.com/arcgis/rest/services/styles/v2/webmaps/arcgis/oceans'. Please visit https://developers.arcgis.com/api-keys to configure the API key to access the resource, or to create a new API key. Is there anything I forgot?
Device: iphone 15 pro (17.5) Xcode 15.4 SPM : 200.5.1
Can you either try creating a new API key following this tutorial, or go to the ArcGIS portal and check if the location services privileges are toggled on for your API key? Let me know the results as we are curious to see the root cause. Thank you!
I'm gonna close this issue as it's been sitting quiet for a while. In the future, if you want to test the key in the app, you can also temporarily hardcode the key in the @main entry point
ArcGISEnvironment.apiKey = .init("<#your-API-key#>")