Skip to content

Auth Portal

认证门户是统一登录入口,提供 SSO 单点登录功能。

特性

  • 统一登录 - 所有应用共享同一个登录入口
  • 自动跳转 - 登录后自动跳转回目标应用
  • SSO 支持 - 已登录用户自动识别,无需重复登录
  • 统一注销 - 退出登录统一处理

技术栈

  • React 19 + TypeScript
  • Vite - 构建工具
  • shadcn/ui - UI 组件库
  • TanStack Query - 数据获取
  • Zustand - 状态管理

开发

bash
pnpm dev

访问:http://localhost:7777

构建

bash
pnpm build

部署

bash
pnpm deploy

使用方式

1. 从其他应用跳转

其他应用未登录时,会自动跳转到认证门户:

http://auth.example.com?redirect=http://app.example.com/dashboard

2. 登录后跳转

登录成功后,会自动跳转回目标应用,并在 URL hash 中传递 token:

http://app.example.com/dashboard#token=xxx

3. 统一注销

退出登录时,会跳转到认证门户进行统一注销:

http://auth.example.com?logout=true

环境变量

详细环境变量配置请查看 Auth Portal README

可选:

  • VITE_API_URL - 后端 API 地址(开发环境自动使用代理)

Released under the MIT License.