Issue
I'm currently learning Google maps Java API
This might be a stupid question, but I noticed that the documentation recommends linking to the API key like so:
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?key=API_KEY">
</script>
I realise you can restrict your API usage by domain, but is there a safer way of linking this? Or should I just not argue with google?
Thanks heaps,
Kieran
Solution
Got to the same question a few weeks ago, and you should not argue with google. You can restrict the domains that can access your api key in your google api console, so if you have a repository on github, you can restrict it to your username, like username.github.io/*, but that will also block you it in your localhost(unless you get a static IP, then you can whitelist it locally), so I recommend just keeping it to yourself, and restricting if you want to share your code with the world.
Answered By - Marcos Sant'Anna
Answer Checked By - Gilberto Lyons (JavaFixing Admin)