|
@@ -40,6 +40,16 @@ export async function getInitialState(): Promise<{
|
|
|
currentUser?: Global.UserInfo;
|
|
currentUser?: Global.UserInfo;
|
|
|
pluginData?: Record<string, any>;
|
|
pluginData?: Record<string, any>;
|
|
|
}> {
|
|
}> {
|
|
|
|
|
+ // SSO 回调 URL 修复:SSO 平台 redirect_uri 不带 #,
|
|
|
|
|
+ // UmiJS hash 路由初始化时会追加 #/login,导致 URL 变成
|
|
|
|
|
+ // /auth/callback?code=xxx#/login,渲染登录页而非回调页。
|
|
|
|
|
+ // 在 getInitialState 最开头用 window.location.href 做硬重定向,
|
|
|
|
|
+ // 浏览器执行时保持当前 host:port 不变。
|
|
|
|
|
+ if (window.location.pathname.startsWith('/auth/callback') && !window.location.hash.startsWith('#/auth/callback')) {
|
|
|
|
|
+ const search = window.location.search;
|
|
|
|
|
+ window.location.href = '/#/auth/callback' + search;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
const { location } = history;
|
|
const { location } = history;
|
|
|
|
|
|
|
|
// In open-source builds the promise resolves immediately.
|
|
// In open-source builds the promise resolves immediately.
|