import Head from "next/head"; import Image from "next/image"; import { faCheck, faCopy } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { IconButton, SecretInput } from "@app/components/v2"; import { SessionStorageKeys } from "@app/const"; import { useTimedReset } from "@app/hooks"; const getTerminalCliToken = () => { const cliTerminalTokenInfo = sessionStorage.getItem(SessionStorageKeys.CLI_TERMINAL_TOKEN); if (!cliTerminalTokenInfo) return; const { expiry, data } = JSON.parse(cliTerminalTokenInfo); if (new Date() > new Date(expiry)) { sessionStorage.removeItem(SessionStorageKeys.CLI_TERMINAL_TOKEN); return; } // eslint-disable-next-line return data as string; }; export default function CliRedirect() { const [isUrlCopied, , setIsUrlCopied] = useTimedReset({ initialState: false }); const cliToken = getTerminalCliToken(); const copyUrlToClipboard = () => { if (cliToken) { navigator.clipboard.writeText(cliToken); setIsUrlCopied(true); sessionStorage.removeItem(SessionStorageKeys.CLI_TERMINAL_TOKEN); } }; return (
Infisical CLI | Login Successful!
Infisical Logo
{cliToken ? ( <>

Unable to reach CLI

Your login was successful but, Infisical couldn't automatically push your login token to the CLI.

Please copy the token below and manually provide it to your CLI.

Copy to clipboard
) : ( <>

Head back to your terminal

You've successfully logged in to the Infisical CLI

)}
); }