shouldTriggerSilentSignin (auth/silent-signin.ts)

Termix · src/ui/auth/silent-signin.ts · typescript · Apache-2.0
auth, tag:embed-classified

Utility to detect and strip silent sign‑in query param for auth flows.

// Source: https://github.com/Termix-SSH/Termix | License: Apache-2.0 | Copyright 2026 Luke Gustafson
// Provided via justclaw.it.com; keep this notice with the code.
export function shouldTriggerSilentSignin(search: string) {
  const params = new URLSearchParams(search);
  for (const [key, rawValue] of params) {
    if (key.toLowerCase() !== "silentsignin") continue;
    const value = rawValue;
    return value === "" || value === "true" || value === "1";
  }
  return false;
}

export function removeSilentSigninFromSearch(search: string) {
  const params = new URLSearchParams(search);
  for (const key of Array.from(params.keys())) {
    if (key.toLowerCase() === "silentsignin") params.delete(key);
  }
  const nextSearch = params.toString();
  return nextSearch ? `?${nextSearch}` : "";
}

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key