fix: oidc has a default oauth state

This commit is contained in:
diced
2025-02-17 11:56:14 -08:00
parent ec8e426964
commit a4b55d102a

View File

@@ -25,13 +25,14 @@ async function handler({ code, host, state }: OAuthQuery, _logger: Logger): Prom
if (!code) {
const linkState = encrypt('link', config.core.secret);
const defaultState = encrypt('default', config.core.secret);
return {
redirect: oidcAuth.url(
config.oauth.oidc.clientId!,
`${config.core.returnHttpsUrls ? 'https' : 'http'}://${host}`,
config.oauth.oidc.authorizeUrl!,
state === 'link' ? linkState : undefined,
state === 'link' ? linkState : defaultState,
config.oauth.oidc.redirectUri ?? undefined,
),
};