Skip to content

SvelteFire + SvelteKit - Using authentication&user back-end #147

@gdrose

Description

@gdrose

We're currently developing a SvelteKit project using Firebase and we wanted to use Sveltefire as well because it's great for what we need.

The problem comes when we want to use the user in the backend (e.g.: +page.server.ts files) and for that we know we cannot import nor use the stores that sveltefire operates with.
What we want to do is something like using the getFirebaseContext() (or anything actually that can give us access to that) function and retrieve the informations we need (e.g.: in the load function of a page):

export const load = async ({ locals }) => {
		const { auth } = getFirebaseContext();
 		console.log('We have the user here!', auth?.currentUser);
};

How should we properly use these functions of sveltefire with SSR and sveltekit? Any feedback is appreciated :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions