Relative Content

Tag Archive for firebaseasynchronousfirebase-authenticationsveltesveltekit

SvelteKit wait for Firebase onAuthStateChanged before load function

I’m working with SvelteKit and Firebase to build a website. There’s a document in my Firestore that only logged in users can accces, I already set a rule for that. The problem that I’m facing is that the load function which fetchs data from the database is sending back a permission denied error as if the user is not logged in. The load function seems to run before the auth state if changed.