Firebase Hooks
Firebase sign-in flows in a few lines, with the edge cases already handled.
Auth hooks
20+
Dependencies
Zero
GitHub stars
1
npm downloads / month
230
Latest version
0.3.0
What I set out to do
Every Firebase app I built needed the same account flows: sign in, sign up, reset a password, verify an email, confirm a password before a sensitive change. Each time, I rewrote the loading states, the error handling, and the edge cases around the same few calls. I wanted to write each flow once, properly, and never think about it again.
What I built
20+ typed hooks for Firebase Authentication and counting, published on npm as @timonwa/firebase-hooks. Each hook runs one flow from start to finish.
- Every way to sign in. Email and password, email links, phone numbers, OAuth providers, anonymous sign-in, and custom tokens, plus linking and unlinking providers on an existing account.
- The whole account lifecycle. Email verification, password resets, profile, email, and password updates, re-authentication before sensitive changes, and account deletion.
- The fiddly parts handled. Email-link sign-in tells you when it needs the address, phone sign-in sets up and cleans up its reCAPTCHA, and OAuth sign-in finishes a redirect when the page comes back.
- Server sessions built in. Every sign-in hands you a fresh token, ready to trade for a session cookie, and sign-out waits for your own clean-up to finish first.
- Errors you can show. Every action returns a success or a readable error carrying Firebase's own code, instead of throwing.
- Light and flexible. Zero dependencies, and it works with Firebase 11 and 12 and React 18 and 19.
Who it's for
React developers building on Firebase Authentication. Instead of wiring loading states, errors, and redirects around every sign-in method, pick the hook for the flow and show its state. Email and password, email links, phone numbers, and OAuth are all ready, so you can spend your time on the parts of the app only you can build.
Where it is now
Authentication is covered, with every hook documented on the project's own site. Firestore, Storage, and Cloud Functions come next, and contributions are welcome.