fix: getLoginUrl() returns /login when VITE_OAUTH_PORTAL_URL is not set

This commit is contained in:
Manus
2026-05-03 06:00:18 -04:00
parent a3a7016130
commit 8a02125fe2

View File

@@ -4,6 +4,13 @@ export { COOKIE_NAME, ONE_YEAR_MS } from "@shared/const";
export const getLoginUrl = () => {
const oauthPortalUrl = import.meta.env.VITE_OAUTH_PORTAL_URL;
const appId = import.meta.env.VITE_APP_ID;
// If OAuth portal URL is not configured (e.g. self-hosted / recette without Manus OAuth),
// fall back to the local login page instead of constructing an invalid URL.
if (!oauthPortalUrl || !appId) {
return "/login";
}
const redirectUri = `${window.location.origin}/api/oauth/callback`;
const state = btoa(redirectUri);