Keeping fal API Secrets Safe
Real-time models using WebSockets present challenges in ensuring the security of API secrets.
The WebSocket connection is established directly from the browser or native mobile application, making it unsafe to embed API keys and secrets directly into the client. To address this, we have developed additional tools to enable secure authentication with our servers without introducing unnecessary intermediaries between the client and our GPU servers. Instead of using traditional API keys, we recommend utilizing short-lived JWT tokens for authentication.
Easiest way to communicate with fal using websockets is through our javascript and swift clients and a server proxy.
When fal.realtime.connect
is invoked the fal client gets a short lived JWT token through a server proxy to authenticate with fal services. This token is refreshed automatically by the client when it is needed.
Checkout the FalRealtimeSampleApp (swift) and realtime demo (js) for more details.