chat-ui / src /routes /login /+page.server.ts
Mishig
[JS] use shorthand notation (#711)
d5559df unverified
raw history blame
No virus
548 Bytes
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);
},
};