plugins – How to pass the API key to the client from the database?

Question

I wrote this simple client in javascript that uses mapbox geocoding API. It is not necessary to hide the API key but what is the correct way of giving that js file access to the API key without hardcoding it?

Is it a good solution to embed the API key in the html file in a hidden div and have js read it from that div?

0
Dangz1 2 months 2021-08-09T16:21:41-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse