headplane/app/routes/oidc.callback.tsx

19 lines
453 B
TypeScript
Raw Normal View History

2024-03-25 17:51:11 -04:00
import { type LoaderFunctionArgs } from '@remix-run/node'
import { loadContext } from '~/utils/config/headplane'
2024-03-25 17:51:11 -04:00
import { finishOidc } from '~/utils/oidc'
export async function loader({ request }: LoaderFunctionArgs) {
const context = await loadContext()
if (!context.oidc) {
2024-03-25 17:51:11 -04:00
throw new Error('An invalid OIDC configuration was provided')
}
return finishOidc(
context.oidc.issuer,
context.oidc.client,
context.oidc.secret,
request,
)
2024-03-25 17:51:11 -04:00
}