Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix: dont inherit exisitng login browser org when using cli login

Scott Wilsonb9dce71bffdb
diff --git a/frontend/src/pages/middlewares/restrict-login-signup.tsx b/frontend/src/pages/middlewares/restrict-login-signup.tsx
index 5b62836a57..fd6984944f 100644
--- a/frontend/src/pages/middlewares/restrict-login-signup.tsx
+++ b/frontend/src/pages/middlewares/restrict-login-signup.tsx
@@ -96,10 +96,14 @@ export const Route = createFileRoute("/_restrict-login-signup")({
if (isOnSelectOrg || (!data.organizationId && location.pathname.endsWith("verify-email")))
return;
+ // org_id makes the select-org page auto-select, so a CLI login must not inherit
+ // this browser's org: it would skip the picker the user is waiting on.
+ const inheritedOrgId = search?.callback_port ? undefined : data.organizationId;
+
throw redirect({
to: "/login/select-organization",
search: {
- org_id: search?.org_id || data.organizationId,
+ org_id: search?.org_id || inheritedOrgId,
callback_port: search?.callback_port
}
});