Change apiKey on runtime Leaflet Google map

Hi, I am using leaflet with google map. I’ve set apiKey in config/environment. It is possible to change the key dynamically? where and how, before it is used by google mutant plugin?


Not sure I understand the question correctly but the key in the config ends up in the generated index.html .You could change the index.html on the backend.

Hi, Thanks for the answer. I am not sure why all google map API ad-dons are made like this. I should be able to set the key when the user logs in. The idea is that I do not want to pay for all clients / users that want to use google map, but I want that each of them to have theirs own key.

You cannot change google API keys without reloading the page, unfortunately.

Thanks for the answers.