Half Your Users Can't Log In: Debugging Auth in a Vibe-Coded App
This year a founder brought us an app where about half of the users had not been able to log in for months. Sentry held around 200,000 error events. New complaints kept arriving from users, and there was a real risk that customer data could leak.
When the developers cannot see the failure themselves, remember that "works on my machine" in auth almost always means the difference sits in the user's browser, account history or network, not in the code path you test.
Step 1: group the errors before reading them
200,000 events sounds like 200,000 problems. Grouped by message and stack trace, they usually collapse into a handful of root causes. Sort by number of affected users, not by number of events. One user in a refresh loop can produce thousands of events on their own.
If you have no error monitoring at all, set it up before anything else. Logging in is the one flow you cannot debug from complaints. Here is .
Step 2: check the six usual causes
1. Cookies the browser refuses to store
Safari and Firefox block third-party cookies by default. If your auth API lives on a different domain from your app (for example called from , or a hosted auth provider on its own domain), the session cookie may never be saved. The user signs in, gets redirected, and lands logged out.
Signal: failures cluster in Safari and iOS. Fix: put auth on the same site, or use a custom domain for the auth provider.
2. Token refresh racing across tabs
The user has two tabs open. Both notice the access token expired and both call refresh at the same moment. The provider rotates the refresh token on the first call, the second call presents the old one, and the provider treats that as token theft and signs the user out everywhere.
Signal: "invalid refresh token" or "refresh token already used" errors, users logged out mid-session. Fix: one refresh at a time (a lock in local storage or a broadcast channel), or rely on the SDK's built-in handling and remove your custom refresh code.
3. Old sessions after a migration
The app changed auth library, session format or JWT secret. New users are fine. Users with a session from before the change carry a cookie the new code cannot read, and the code throws instead of treating them as logged out.
Signal: failures only for accounts older than a certain date. Fix: on any session parse error, clear the cookie and send the user to login.
4. Email case and whitespace
signed up. tries to log in. Some providers normalise and some do not. Mobile keyboards add a trailing space or capitalise the first letter.
Signal: "user not found" for users who exist. Fix: lowercase and trim on signup and login, and run a one-off migration for existing rows.
5. Redirect URLs that differ by environment
OAuth providers only accept redirect URLs from an allowlist. AI-generated code often hardcodes or reads the URL from an environment variable that is set in one deploy target and missing in another. vs no- counts as a different URL.
Signal: Google or GitHub login fails while email login works. Fix: one canonical domain, redirect the other, and list exact URLs per environment.
6. Rate limits on the auth provider
Free tiers of hosted auth limit sign-ins and emails per hour. A marketing push or a bot can use them up, and then legitimate users get errors.
Signal: failures in bursts at specific times. Fix: check the provider dashboard and add your own rate limiting in front.
Step 3: fix the cause, then prove it
For each fix, watch the error group in your monitoring tool. The count for that group should fall to near zero within a day or two of the deploy. If it does not, the fix addressed a symptom.
Should you rewrite auth?
Rarely. Replacing the auth system on a live app forces every user to reset their password or re-link their account, and it creates its own wave of support tickets. Fix the specific failures first. Consider a replacement only if the existing library is unmaintained or the data model fights you on every change.
If your users cannot log in and you cannot reproduce it, our starts exactly here: group the errors, find the causes, fix them in place.
FAQ
What services do we provide?
We specialize in creating innovative digital solutions including web development, mobile applications, CRM systems, and enterprise software. Our services are tailored to meet your specific business needs and drive growth.

Oleksii Stupak
CEO @ AleannLab
"Want to explore how we can help your business grow? Let's connect and discuss your project on LinkedIn."
Ready to discuss your project with us?




