Why client-side rate limiting can't stop API abuse
It's tempting to cap how often your app calls a provider from inside the app — a counter, a debounce, a cooldown. It feels like a limit. It isn't. Anything the client enforces, the client can remove.
The attacker owns the client
Once your app is installed, its logic runs on a device the attacker controls. They can decompile it, patch out the counter, or skip the app entirely and replay the raw HTTP calls with the extracted key. Your in-app limit is a polite suggestion they are free to ignore. Read more: Your API key ships inside your app — and anyone can read it.
Limits have to live where you control them
The only limit that holds is one enforced on the server, before the request reaches the provider. Tie it to the authenticated user, not the key:
- Per-user windows — N requests per minute/hour/day per user, counted server-side.
- Cooldowns — past the limit, the user is temporarily blocked with a
429and a retry time. - One-click disable — a clearly abusive user is cut off without touching anyone else.
Why per-user, not per-key
A single shared key gives you one number and one blunt instrument: revoke it and everyone breaks. Per-user limits contain one bad actor to themselves. Pair them with app attestation (App Check) so that calls without a valid attestation are rejected. Read more: Firebase App Check: what it actually protects (and what it doesn't).
This is exactly what a proxy in front of your provider gives you. See how it works in the docs.
Stop shipping your API key inside your app.
Swap the base URL, keep the provider's native API, and let the proxy inject your key server-side.
Start free