fix: Keep OIDC provider identifier in sync with configured domain (#13574)

This commit is contained in:
Tom Moor authored and GitHub committed 2026-08-27 16:09:55 -04:00
1 parent d2697d354e
commit 46cfa0c8d0
1 file changed
+17 -1
+17 -1
View File
@@ -164,9 +164,25 @@ export function createOIDCRouter(
// Derive a providerId from the OIDC location if there is no existing provider.
const oidcURL = new URL(endpoints.authorizationURL);
const providerId =
let providerId =
authenticationProvider?.providerId ?? oidcURL.hostname;
// The provider can move to a different domain, in which case the
// stored identifier must follow the configured location.
if (authenticationProvider && providerId !== oidcURL.hostname) {
try {
await authenticationProvider.update({
providerId: oidcURL.hostname,
});
providerId = oidcURL.hostname;
} catch (error) {
Logger.warn(
"Could not update OIDC authentication provider identifier",
{ providerId, hostname: oidcURL.hostname, error }
);
}
}
if (!domain) {
throw OIDCMalformedUserInfoError();
}