Using api key from backend to frontend
I am working on a project where I need an API key in the frontend.
I have the api key stored in the backend, and now have set up the javascript for this to get to the frontend, code is down below. Is there a way to hide this key? Right now it gets shown in the sources. Or is this not possible at all?
2 Replies
If you need it in fronted than it is not possible to hide the key.
The best way to hide a key is to do the calls in backend
I want to do that, but im not sure how i can return data that way. I know i can use $wire.<method> but that will fire the method set in CreateLocation.php in my case.
Or is the only way to do this is by dispatching two events? One for calling the initial event, and one for retrieving the data in the javascript?