Skip to content
All writing

Not every coach has a Google account, so I built a login that does not need one

Google sign-in is the convenient default. It is also a closed door for every coach who does not have a Google account.

CoachesDev, the CrossFit cert prep platform I built with Pat Barber, launched with exactly one way in: a single Google button. That is fine until a coach who runs their life on an Outlook or iCloud address lands on the page, sees one button their account cannot satisfy, and leaves. They do not email support. They just close the tab. For a $300 lifetime product, that is a paying customer lost at the threshold.

So this week I gave them a second door.

The shape

One auth surface, two ways through it. The existing Google path stays. I added a local email and password path on the same React client and Express server, issued as a JWT in an HttpOnly cookie named cfm_auth. Three new endpoints: register, login, logout. Register returns 201, login returns 200, a duplicate email returns 409, a bad password returns 401. Built and verified end to end on the dev environment at dev.coachesdev.com. Production is the next deploy.

old: one button. Sign in with Google. no Google account, no entry, no sale.
new: Google stays the default, plus an Email tab. register, login, logout. same protected routes, either path.

The whole change is additive. Nobody who already signs in with Google notices a thing. The new code sits beside the old code instead of on top of it.

The cookie that had to coexist

The app already authenticates with a Passport session, and Google sign-in works, so ripping it out was never on the table. The email path issues its own JWT cookie, and I taught the protected routes to accept either credential. /api/user checks for a Passport session or a valid cfm_auth cookie and is happy with either. A coach who signs in with Google gets a session. A coach who signs in with email gets a cookie. Both land in the same place. Logout clears whichever one they are holding. Two doors, one room behind them.

The deploy that hung on a migration it did not need

The dev deploy wrapper got stuck mid-run inside drizzle-kit push, waiting on a schema sync. This feature added zero schema changes. No new columns, no new tables, nothing for the migration step to do. It was waiting on nothing. I stopped the hung wrapper, ran an explicit build and a single pm2 restart cfmaster-dev, and the app came back clean. curl https://dev.coachesdev.com/health returned {"status":"ok"}. A generic deploy script runs every step whether your change needs it or not, and the one that does not apply is the one that hangs.

Proving it before calling it done

Then the part that actually earns the word shipped. Register a throwaway account, /api/user returns that user. Log out, /api/user returns null. Log in again, back in. Duplicate registration returns 409 with a message that tells the coach to sign in or use Google. Bad password returns 401. Then I deleted the test users from the dev database so the verification left no residue. The type-checker was throwing errors the entire time, learning-path typings, a Firebase window type, some storage duplicates, but every one of them predated my branch. Telling my own regressions apart from the repo's standing noise was half the work.

What I learned

A convenient default is still a wall for whoever it excludes. Google sign-in is one click for people with Google accounts and a dead end for everyone else. The fix was not clever, an email field and a password field, but it opens the door for a coach paying $300 who happens to live on Outlook.

Add the new path beside the old one, not on top of it. The JWT cookie did not replace the Passport session, it sits next to it, and /api/user accepts either. Nobody who already signs in with Google noticed a thing. Additive auth is how you hang a second door without rehanging the first.

Know which errors are yours. The type-checker failed the whole time I worked, and none of it was my code. Treat a repo's pre-existing noise as your regression and you will chase ghosts for an hour. Verify against what was already broken before you blame your own change.

If you have a product turning away paying customers at the login screen, clearing that kind of friction is what Autosterea does. Talk to me.

First published on ravikantdewangan.com.

Tell us what eats your week.

A free 20-minute call. We'll show you what we would take off your plate.

Book a call