fix: read oidc configuration from env then config
This commit is contained in:
parent
78140927ad
commit
6fa27e5d28
3 changed files with 48 additions and 11 deletions
|
|
@ -1,15 +1,15 @@
|
|||
import { type LoaderFunctionArgs } from '@remix-run/node'
|
||||
|
||||
import { getContext } from '~/utils/config'
|
||||
import { finishOidc } from '~/utils/oidc'
|
||||
|
||||
export async function loader({ request }: LoaderFunctionArgs) {
|
||||
const issuer = process.env.OIDC_ISSUER
|
||||
const id = process.env.OIDC_CLIENT_ID
|
||||
const secret = process.env.OIDC_CLIENT_SECRET
|
||||
const context = await getContext()
|
||||
const oidc = context.oidcConfig
|
||||
|
||||
if (!issuer || !id || !secret) {
|
||||
if (!oidc) {
|
||||
throw new Error('An invalid OIDC configuration was provided')
|
||||
}
|
||||
|
||||
return finishOidc(issuer, id, secret, request)
|
||||
return finishOidc(oidc.issuer, oidc.client, oidc.secret, request)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue