Files
Fabric/docs/DEPLOY_AUTH_FLOW.md

60 lines
1.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Fabric 部署鉴权流程Center / Guild / Frontend
## 1) Admin 注册 Guild在 Center 本机执行)
```bash
scripts/register-guild-node.sh <node_id> <name> <endpoint>
```
成功后会输出:
```bash
CENTER_API_KEY=...
```
> `nodes/register` 仅允许 localhost 调用。
---
## 2) 部署 Guild
在 Guild 的部署配置(`.env` / compose填写
- `CENTER_BASE_URL`
- `CENTER_API_KEY`(上一步拿到)
- `GUILD_NODE_ID`
Guild 启动前会强校验这三项,缺失即启动失败。
---
## 3) Frontend 登录
登录页填写:
- `Center API Base URL`
- `Center API Key`
- 用户名/密码
登录成功后Center 返回:
- 用户可访问 guild 列表
- 每个 guild 对应的访问 token
Frontend 使用这些 token 直连各 Guild 拉 channels/messages。
---
## 4) Center API 访问规则
- `POST /api/nodes/register`:无需 API Key但仅 localhost
- 其他 Center API全部需要 `x-api-key`
---
## 5) 常见错误
- `401 missing/invalid api key`Center API Key 未传或错误
- `403 register endpoint only allows localhost caller`:注册接口不是本机调用
- Guild 启动失败 `Missing required env`:缺 `CENTER_BASE_URL` / `CENTER_API_KEY` / `GUILD_NODE_ID`