- To implement native authentication and OAuth, you can use SvelteKit’s Sequence helper function.
- In your existing
hooks.server.tsfile, add the following:
Implementation
Using Both
Implement both native authentication and OAuth into your application
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Implement both native authentication and OAuth into your application
hooks.server.ts file, add the following:import { sequence } from '@sveltejs/kit/hooks';
/*
NOTE: CANNOT HAVE 2 HANDLE FUNCTIONS!
export const handle = SvaultNative(redirectPath);
export const handle = SvaultOauth({ providers });
*/
// Rename functions to their corresponding type of authentication
export const native = SvaultNative(redirectPath);
export const oauth = SvaultOauth({ providers });
// Use sveltekit sequence method to run both hooks in sequence
export const handle = sequence(oauth, native);
