Google Maps w/ JS SDK : Protect API key?

Hey everyone,
I want to use the JS SDK for Google maps, but i don’t want anyone to retrieve my api key.
Right now it is in my index.html, after the Google Maps script :

<script src=""></script>

In the google developer console you can restrict this key to domain names, in the case of a mobile app i don’t see how to limit the usage of my key to just my application. I also have no intend of using the native plugin. Any ideas?


I’m just having the same issue, I tried using Google maps native sdk cordova plugin, but the plugin has many issues how works with ionic, there you define api keys in config.xml and that looks more “native” way, but I think I will switch to JS and I have the same issues, still didn’t found a way, what could be one solution is, if you have auth with your server, to return the key once user is logged in, sure its not ideal, but at least you have one layer of protection :slight_smile:

If I find some solution will post it here