-
-
Notifications
You must be signed in to change notification settings - Fork 8
Closed
Description
The access token can be retrieved server side. Because createSvelteAuthClient doesn't except a token as input there's no way to use the client during SSR. If the token is passed in (event if undefined/null) the token shouldn't be fetched. I don't see any reason that this wouldn't be the preferred happy path moving forward.
I would love to see this:
layout.server.ts
import type { LayoutServerLoad } from './$types';
export const load = (async ({ locals: { token } }) => {
return {
token
};
}) satisfies LayoutServerLoad;layout.svete (root)
<script lang="ts">
import '../app.css';
import favicon from '$lib/assets/favicon.svg';
import { createSvelteAuthClient } from '@mmailaender/convex-better-auth-svelte/svelte';
import { authClient } from '$lib/auth-client';
let { children, data } = $props();
createSvelteAuthClient({
authClient,
options: {
token: data.token
}
});
</script>
<svelte:head>
<link rel="icon" href={favicon} />
</svelte:head>
{@render children?.()}Metadata
Metadata
Assignees
Labels
No labels