fix: getLoginUrl() returns /login when VITE_OAUTH_PORTAL_URL is not set
This commit is contained in:
@@ -4,6 +4,13 @@ export { COOKIE_NAME, ONE_YEAR_MS } from "@shared/const";
|
|||||||
export const getLoginUrl = () => {
|
export const getLoginUrl = () => {
|
||||||
const oauthPortalUrl = import.meta.env.VITE_OAUTH_PORTAL_URL;
|
const oauthPortalUrl = import.meta.env.VITE_OAUTH_PORTAL_URL;
|
||||||
const appId = import.meta.env.VITE_APP_ID;
|
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 redirectUri = `${window.location.origin}/api/oauth/callback`;
|
||||||
const state = btoa(redirectUri);
|
const state = btoa(redirectUri);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user