A verified-email screen and a Firestore-authorised request are not the same observation. Your UI can show updated account state while the request still uses an older ID token, or the write can fail a different rule entirely. Diagnose user state, token claims, project identity and the complete rule predicate before relaxing database permissions.
Identify which state the UI is displaying
A local component may cache a user object or a separate verified flag. Confirm that the application reads current Firebase account state rather than a value written by an earlier screen. If the user completed verification in another tab, the original page may not have updated automatically in the way your UI assumes.
Do not use a client-written verified field as the authority for database access. Security rules should rely on trusted authentication claims and the intended resource checks. A person must not be able to grant themselves a privileged state by editing a profile document.
Refresh deliberately after the verification flow
The JavaScript User API distinguishes reloading user data from retrieving an ID token with forced refresh. A typical client check reloads the current user, confirms the account state and requests a fresh token before retrying the intended operation. Handle errors and sign-out transitions rather than assuming a user always exists.
Never log the returned token. If you inspect claims in a controlled development environment, retain only the non-sensitive assertion needed for the test. Do not paste a complete token into a public issue or article.
const user = auth.currentUser;
if (!user) throw new Error('Sign in first');
await user.reload();
if (!user.emailVerified) throw new Error('Verify your email first');
await user.getIdToken(true);
// Now attempt the authorised write; keep server-side rules enforced.Verification must reach the request's claims
A simplified client flow. Actual permission also depends on the rest of the deployed rules.
Account
- Email action
The person completes the provider's verification flow.
- Reload and token refresh
The client deliberately refreshes relevant account and token state.
Database
- Authenticated request
Firestore evaluates claims on the request, not a UI label.
- Full rule predicate
Ownership, field validation and other constraints still apply.
Refreshing a token can fix stale claims; it cannot make an invalid or unauthorised write valid.
Check the project and identity boundary
Confirm Auth and Firestore use the intended Firebase project and app configuration. A development client connected to one project and rules deployed to another can produce confusing results. Also check whether the current signed-in account is the one that completed verification.
A successful Google sign-in and an email/password flow can have different user journeys. Do not infer a particular claim from the button label alone; inspect the trusted authentication state in a safe test. Keep account identifiers out of public diagnostics.
Read the complete rule predicate
An email_verified requirement is only one possible condition. The write may also need the correct owner, allowed fields, valid text length, server timestamp or an existing parent resource. A fresh token cannot repair a malformed document or another user's target.
Scroll the table horizontally to see all columns.
| Boundary | Test fixture | What a failure suggests |
|---|---|---|
| Signed out | No authenticated identity | Sign-in is required |
| Signed in, unverified | Verified claim false | Verification gate should reject |
| Verified, valid own write | Correct claims and permitted data | Intended happy path should pass |
| Verified, another owner | Different resource ownership | Authorisation should reject |
| Verified, invalid fields | Extra or malformed data | Validation should reject |
| Wrong environment | Mismatched project setup | Configuration needs correction |
Use the emulator to isolate rules
Build disposable fixtures with explicit authentication claims and invented documents. Test both the allowed write and the nearby rejected cases. A rule test that only proves one success does not establish that cross-user access is blocked.
Keep the deployed rules strict while investigating. Do not temporarily allow all authenticated writes on production to see whether the UI starts working. That changes the security boundary and can expose data while leaving the original client defect unresolved.
Give the reader a useful recovery state
If verification is still pending, explain how to complete it and offer a deliberate recheck. If the token refresh or write fails, distinguish a temporary connection problem from permission denied where the SDK supports that distinction. Preserve the draft without repeatedly submitting it in an automatic loop.
After a successful write, render the confirmed result rather than only an optimistic success message. If optimistic UI is used, reconcile failures visibly. The person should not believe a comment was stored when rules rejected it.
Verify the whole flow before release
Test the email action, return to the original page, state refresh, authorised write and an unauthorised counterexample in the intended environment. Passing an emulator test proves rule behaviour under those fixtures; it does not alone prove the live identity configuration. Report both boundaries accurately and keep tokens and personal data out of the evidence.
Frequently asked questions
Why can Firestore reject a write after email verification? The request may carry stale claims, use a different project or account, or fail another rule such as ownership or field validation. Inspect the complete request path before changing rules.
Does reloading the Firebase user force a new ID token? Treat user reload and forced token refresh as separate operations. The User API documents getIdToken with a forceRefresh argument; use it deliberately when claims must be refreshed.
Should I allow every signed-in user to write to fix this? No. Keep the intended verification, ownership and validation rules. Use emulator fixtures to find the failing predicate and repair the client or rule logic without broadening access unnecessarily.
Sources
- Firebase: authentication and security rules
- Firebase JavaScript User reference
- Firestore Rules Request reference
- Related practical guide
Technical references checked .



