File size: 548 Bytes
64d3841
767afa7
 
64d3841
 
d5559df
64d3841
767afa7
64d3841
767afa7
64d3841
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { redirect } from "@sveltejs/kit";
import { getOIDCAuthorizationUrl } from "$lib/server/auth";
import { base } from "$app/paths";

export const actions = {
	async default({ url, locals, request }) {
		// TODO: Handle errors if provider is not responding
		const referer = request.headers.get("referer");
		const authorizationUrl = await getOIDCAuthorizationUrl(
			{ redirectURI: `${(referer ? new URL(referer) : url).origin}${base}/login/callback` },
			{ sessionId: locals.sessionId }
		);

		throw redirect(303, authorizationUrl);
	},
};