Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix(sso): add "username" scope when applicable for OIDC (#4671)

Joe Chen9fd783333351
diff --git a/frontend/src/utils/sso.ts b/frontend/src/utils/sso.ts
index 2a566d93e4..7b93e33eac 100644
--- a/frontend/src/utils/sso.ts
+++ b/frontend/src/utils/sso.ts
@@ -43,6 +43,12 @@ export async function openWindowForSSO(
)
).data;
+ // Some IdPs like authning.cn doesn't expose "username" as part of standard claims,
+ // so we need to request the claim explicitly when possible.
+ if (openidConfig.scopes_supported.includes("username")) {
+ oidcConfig.scopes.push("username");
+ }
+
const redirectUrl = encodeURIComponent(
`${window.location.origin}/oidc/callback`
);