P粉8721820232023-08-25 09:30:52
If you're reading this page in 2020 and don't want to develop server-side code for whatever reason (saving hosting costs, etc.), serverless functions may be the solution.
This also calls third-party APIs from the server side, but you don't have to develop a full server-side API proxy.
Netlify has relevant documentation. I guess other providers like AWS Lambda, Google Cloud Function also offer similar functionality, but not sure.
https://github.com/netlify/code-examples/tree/master/function_examples/token-hider
advantage No server management required
shortcoming Vendor lock-in
P粉2452767692023-08-25 00:22:43
In short: No, you cannot protect your API keys in client applications.
This article details some details
Two options: