Merge pull request #479 from multica-ai/fix/cli-web-shared-login-state

fix(auth): persist browser session during CLI login flow
This commit is contained in:
Jiayuan Zhang 2026-04-08 12:50:53 +08:00 committed by GitHub
commit 88c2f4ddc4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View file

@ -2,7 +2,7 @@
import { Suspense, useState, useEffect, useCallback } from "react";
import { useSearchParams, useRouter } from "next/navigation";
import { useAuthStore } from "@/features/auth";
import { useAuthStore, setLoggedInCookie } from "@/features/auth";
import { useWorkspaceStore } from "@/features/workspace";
import { api } from "@/shared/api";
import {
@ -146,6 +146,10 @@ function LoginPageContent() {
return;
}
const { token } = await api.verifyCode(email, value);
// Persist session in the browser so the web app stays logged in
localStorage.setItem("multica_token", token);
api.setToken(token);
setLoggedInCookie();
const cliState = searchParams.get("cli_state") || "";
redirectToCliCallback(cliCallback, token, cliState);
return;

View file

@ -1,2 +1,3 @@
export { useAuthStore } from "./store";
export { AuthInitializer } from "./initializer";
export { setLoggedInCookie } from "./auth-cookie";