fix(oidc): allow paths in wellknown lookup

pull/2792/head
Jakob Ankarhem 2 years ago
parent cefe1fe1ba
commit 6e899480d5
No known key found for this signature in database
GPG Key ID: 149CBB661002B3BE

@ -4,15 +4,13 @@ import * as yup from 'yup';
/** Fetch the oidc configuration blob */
export async function getOIDCWellknownConfiguration(domain: string) {
const wellKnownInfo: WellKnownConfiguration = await fetch(
new URL(
'/.well-known/openid-configuration',
`https://${domain}`
).toString(),
{
// remove trailing slash from url if it exists and add /.well-known/openid-configuration path
const wellKnownUrl = new URL(
`https://${domain}`.replace(/\/$/, '') + '/.well-known/openid-configuration'
).toString();
const wellKnownInfo: WellKnownConfiguration = await fetch(wellKnownUrl, {
headers: new Headers([['Content-Type', 'application/json']]),
}
).then((r) => r.json());
}).then((r) => r.json());
return wellKnownInfo;
}

@ -26,8 +26,9 @@ function OIDCLoginButton({ revalidate, oidcName }: Props) {
} catch (e) {
setLoading(false);
return;
}
} finally {
setLoading(false);
}
};
return (

Loading…
Cancel
Save