I have enabled sign-in with Google’s provider.
All works fine when a user signs in to the new session and accesses resources.
The issue is when a user signs out and then signs in again, the Firestore rules check fails on the following rule:
allow read, write: if request.auth != null;
with the following error:
Unhandled Runtime Error
FirebaseError:
false for 'get' @ L59
When a user refreshes the page before signing, it all works fine.
Debugging on the client side, I can see the user is being correctly authenticated as I get the user ID and user ID token.
For some reason, this still fails, as if the user was not authenticated.
I tried using the debug() statement around the rule, and the interesting thing is that:
- When the user logs in with the new session, I can see the “true” output in the logs.
- When the user signs in after signing out, I can’t see the debug output (“true” or “false”) in the logs until I refresh the page.
This behavior is consistent between emulators, Cloud Runa, and the full Firebase suite.
Sign out logic
const SignOut = () => {
const router = useRouter()
useEffect(() => {
const signOut = async () => {
await firebaseAuth.signOut();
router.push("/sign-in");
}
signOut().catch((error) => {
console.log("Error signing out: ", error)
})
}, [router])
return (
<p className="text-center text-small">
Signing out...
</p>
)
}