Select to view content in your preferred language

WPF app with Api key not working

391
2
Jump to solution
08-08-2024 06:44 AM
papillon2k2
New Contributor

Hi, noob here.

I have created an Location Platform Account (or so I think... by the way, how can I check what type my account is?).

Then I followed this tutorial to create an API key:

https://developers.arcgis.com/documentation/security-and-authentication/api-key-authentication/api-k... 

And followed this tutorial to create WPF app with a simple map:

https://developers.arcgis.com/net/maps-2d/tutorials/display-a-map/ 

 

But when I run the app, it shows MainWindow, with the text "powered by Esri" in bottom-right corner, but no map is shown.

In output window, it says "The provided APIKey is invalid, expired or does not have access to the resource."

 

What am I doing wrong?

 

note - when creating the API key, in the Referrers step, I did put "*", as I am not sure what to write there... (my app is WPF, so no domain involved...?¿)

 

Tags (2)
1 Solution

Accepted Solutions
dotMorten_esri
Esri Notable Contributor

Leave the referrer blank and it should work. I reproduced putting in a * will break it.

 

You can also specify an actual referrer url like this:

dotMorten_esri_1-1723132204615.png

And then in the app configure it to use that referrer:
dotMorten_esri_2-1723132301273.png

 

Also make sure you enable at least the basemap service (and anything else you plan on using the key for)

dotMorten_esri_0-1723132180146.png

 

View solution in original post

0 Kudos
2 Replies
dotMorten_esri
Esri Notable Contributor

Leave the referrer blank and it should work. I reproduced putting in a * will break it.

 

You can also specify an actual referrer url like this:

dotMorten_esri_1-1723132204615.png

And then in the app configure it to use that referrer:
dotMorten_esri_2-1723132301273.png

 

Also make sure you enable at least the basemap service (and anything else you plan on using the key for)

dotMorten_esri_0-1723132180146.png

 

0 Kudos
papillon2k2
New Contributor

That made it! thanks mate. 

By the way, I have come to know about all this ArcGIS SDK and its possibilites after trying your NmeaParser. Learning a lot with it! (even if its too advanced for my current c# level lol)