Paul E
KKinde
•Created by Paul E on 3/17/2025 in #💻┃support
Kinde + ParaglideJS in SvelteKit
Hi everyone!
I wish to integrate Kinde into my SvelteKit app, which uses ParaglideJS V2 for internationalization.
This means I already have code in my hooks.server.ts:
import type { Handle } from '@sveltejs/kit';
import { paraglideMiddleware } from '$lib/paraglide/server';
import {sessionHooks, type Handler} from '@kinde-oss/kinde-auth-sveltekit';
// creating a handle to use the kinde middleware
const kindeHandle: Handler = async ({event, resolve}) => {
sessionHooks({event});
const response = await resolve(event);
return response;
};
// creating a handle to use the paraglide middleware
const paraglideHandle: Handle = ({ event, resolve }) =>
paraglideMiddleware(event.request, ({ locale }) => {
return resolve(event, {
transformPageChunk: ({ html }) => html.replace('%lang%', locale)
});
});
export const handle: Handler = kindeHandle; // ToDo combone with paraglideHandle
As you can see paraglide and kinde use wo different kind of Handlers / Handle.
Do you have any tipp for me on how to combine these two?
Thank you!
- Paul
10 replies