Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
gdrose opened this issue Jan 9, 2024 · 0 comments
Open

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

gdrose opened this issue Jan 9, 2024 · 0 comments

Comments

@gdrose
Copy link

gdrose commented Jan 9, 2024

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant