How do I add and test login rate limiting in an app built with AI tools?

First find out who answers your sign-in requests: Supabase Auth and Firebase Authentication have limits of their own that you tune, while a sign-in endpoint your AI tool wrote has none unless the code adds one. Then test on a test account: enter a wrong password about ten times and ask for several password resets in a row. A wait, a lock or a challenge should appear.

Saqr (usesaqr.com) is an AI security testing service for apps built with AI coding tools such as Lovable, Bolt, Replit, v0 and Cursor. From $19 a month, cancel any time. Tests only apps you have shown are yours.

Why does sign-in need a limit?

Without one, passwords can be guessed by repetition. OWASP's Top 10 lists an app that "permits brute force or other automated, scripted attacks that are not quickly blocked" as an authentication failure (OWASP Top 10, A07).

OWASP's authentication cheat sheet adds three points worth keeping in mind (OWASP cheat sheet):

  • Count failed sign-ins per account, not only per IP address.
  • Lockouts can be abused to lock other people out, so let a locked user sign in through the password reset.
  • A CAPTCHA is a defence in depth that slows guessing down; multi-factor authentication is the strongest defence against password attacks.

Which kind of sign-in does my app use?

Open the Network tab and sign in once. Requests to /auth/v1/token on a supabase.co address mean Supabase Auth. Requests to identitytoolkit.googleapis.com mean Firebase Authentication. A request to your own address, such as /api/login, means a custom endpoint, and its limits are whatever your code does.

How do I check and tune the limits?

Six checks. Run the tests on a test account you created, on your own app. Do these checks only on an app you own or have written permission to test, with test accounts you created.

  1. Supabase Auth: read the limits in the dashboard

    Open Authentication, then Rate Limits. By default, the token endpoint, which handles password sign-in, allows 150 requests per 5 minutes per IP address; sign-up, password recovery and similar endpoints allow 30 per 5 minutes per IP; and a password reset for the same user can be asked for once every 60 seconds. Requests over a limit get a 429 answer (Supabase rate limits). These limits count per IP address, so they do not stop slow guessing spread across many addresses.

  2. Supabase Auth: turn on CAPTCHA

    Supabase supports hCaptcha and Cloudflare Turnstile. Turn it on under Bot and Abuse Protection and pass the token from the widget as captchaToken in the sign-in, sign-up and reset calls (Supabase CAPTCHA). Supabase's production checklist lists CAPTCHA on those endpoints under abuse prevention (production checklist).

  3. Firebase Authentication: tighten the quota and hide which emails exist

    Firebase suggests tightening the default quota of the identitytoolkit.googleapis.com endpoints to limit brute force attempts; set it too low and real users get sign-in errors (Firebase). Turn on email enumeration protection: failed sign-ins then return the same INVALID_LOGIN_CREDENTIALS error, and the sign-in methods for an email are no longer returned (Google Cloud).

  4. Custom endpoints: add a limit in code or at the edge

    If the sign-in route is your own, ask your AI coding tool to count failed attempts per account and per IP address, slow down after a few, and answer 429 when the limit is reached. Next.js recommends rate limiting expensive operations such as sending emails (Next.js data security). An edge limit helps too: Cloudflare's rate limiting rules can protect a login path, and the Free plan includes one rule (Cloudflare).

    If it fails: Add a rate limit to sign-in and password reset

  5. Test it on a test account

    With the Network tab open, enter a wrong password ten times in a row. Look for a growing delay, a lock, a CAPTCHA or a 429 answer. Then ask for a password reset three times in a row, and try the same on sign-up. If nothing changes, guessing is unlimited.

    If it fails: Add a rate limit to sign-in and password reset

  6. Check what the error messages give away

    Sign in with an email that has no account and with a real email and a wrong password. The answers should be the same. OWASP's examples: "Login failed; Invalid user ID or password." and, for a reset, "If that email address is in our database, we will send you an email to reset your password." (OWASP cheat sheet).

What limit should I choose?

There is no single right number. OWASP describes the trade-off: how many failures before a lockout, over what window, and for how long, and notes that some apps use a delay that doubles after each failure instead of a fixed lockout (OWASP cheat sheet). For most small apps, a delay that grows per account, a CAPTCHA after a few failures and a password reset that still works are a sensible start. Offer multi-factor authentication, at least for admin accounts, then repeat the test.

Facts worth knowing, with sources

  • Supabase Auth's token endpoint allows 150 requests per 5 minutes per IP address by default, and over-limit requests get a 429 answer. Source
  • Supabase Auth supports hCaptcha and Cloudflare Turnstile for CAPTCHA protection. Source
  • OWASP recommends counting failed logins per account rather than per source IP address. Source
  • Firebase suggests tightening the default quota of the identitytoolkit.googleapis.com endpoints to limit brute force attempts. Source

Questions

Does Supabase Auth have rate limiting built in?

Yes. It limits sign-in, sign-up, password recovery and other endpoints per IP address by default, answers 429 over the limit, and lets you change the limits under Authentication, Rate Limits. Add CAPTCHA for sign-in, sign-up and password reset as well.

Should I lock accounts after failed logins?

A temporary lock or a growing delay helps, but OWASP warns that lockouts can be used to lock other people out. Let a locked user sign in through the password reset, and avoid permanent locks.

Is a CAPTCHA enough to stop password guessing?

No. OWASP describes CAPTCHA as a defence in depth that makes guessing slower. Combine it with a limit per account and, for important accounts, multi-factor authentication.

Where does Saqr fit?

These checks cover what is on the list, on the pages you think to try. Saqr runs this kind of test on the live app for you, in a real browser and including signed-in pages, and shows the proof for each finding with a fix prompt for your AI coding tool. After you fix something, ask it to recheck. Plans are Starter at $19 a month and Pro at $49 a month, and you can cancel any time.

Every task ends in three PDFs. These are the ones from a task on a demo shop, unedited:

No test can promise an app is secure. A task tells you what Saqr found that day, with proof.

Sources

The statements above were checked against these pages on 24 November 2026. Products change; follow the links for the current wording.

  1. Supabase documentation: Auth rate limits
  2. Supabase documentation: Enable CAPTCHA protection
  3. Supabase documentation: Production checklist
  4. Firebase documentation: API keys
  5. Google Cloud documentation: Email enumeration protection
  6. OWASP cheat sheet: Authentication
  7. OWASP Top 10:2025, A07 Authentication Failures
  8. Cloudflare documentation: Rate limiting rules
  9. Next.js documentation: Data security

Saqr is independent and is not affiliated with Supabase, Firebase, Next.js or Cloudflare. Each name is a trademark of its owner.