I've got a javascript front end and I need to make an API call to a 3rd party API requiring an API key. I'm fairly certain there is no way to actually secure that key if used in the javascript code since anyone can find it if they try.
I have also read other similar questions where the top suggestion is usually "make the request from the server side". That makes sense, as nobody will see the API access key, but what I DON'T understand about this solution, is if I make a call to this new intermediate layer API that can still be discovered by someone looking through the browser....so while they can no longer discover my API key for the API I'm trying to access it - they no longer NEED it because the intermediate layer simply adds the key for them and forwards on the request. I've essentially created a way to access the 3rd party api WITHOUT using a key.
(Javascript -> Makes Request to new API with no key -> New Api -> Makes request to 3rd party API with key -> New API returns results to Javascript)
Am I missing something here? How is that more secure? Isn't there some other step required to secure it? I've tried to find a concise answer in similar questions but no luck thus far.
Thanks.