diff --git a/apps/docs/content/guides/auth/server-side/email-based-auth-with-pkce-flow-for-ssr.mdx b/apps/docs/content/guides/auth/server-side/email-based-auth-with-pkce-flow-for-ssr.mdx index 02fe242a0a0..24a69be3362 100644 --- a/apps/docs/content/guides/auth/server-side/email-based-auth-with-pkce-flow-for-ssr.mdx +++ b/apps/docs/content/guides/auth/server-side/email-based-auth-with-pkce-flow-for-ssr.mdx @@ -75,30 +75,30 @@ export async function GET(request: NextRequest) { -Create a new file at `src/routes/auth/confirm/+server.js` and populate with the following: +Create a new file at `src/routes/auth/confirm/+server.ts` and populate with the following: -```js src/routes/auth/confirm/+server.js -import { redirect } from '@sveltejs/kit'; +```ts src/routes/auth/confirm/+server.ts +import { redirect } from '@sveltejs/kit' export const GET = async (event) => { - const { - url, - locals: { supabase } - } = event; - const token_hash = url.searchParams.get('token_hash') as string; - const type = url.searchParams.get('type') as string; - const next = url.searchParams.get('next') ?? '/'; + const { + url, + locals: { supabase }, + } = event + const token_hash = url.searchParams.get('token_hash') as string + const type = url.searchParams.get('type') as string + const next = url.searchParams.get('next') ?? '/' if (token_hash && type) { - const { error } = await supabase.auth.verifyOtp({ token_hash, type }); + const { error } = await supabase.auth.verifyOtp({ token_hash, type }) if (!error) { - throw redirect(303, `/${next.slice(1)}`); + throw redirect(303, `/${next.slice(1)}`) } } // return the user to an error page with some instructions - throw redirect(303, '/auth/auth-code-error'); -}; + throw redirect(303, '/auth/auth-code-error') +} ```