Repository navigation
fix(aurora): adopt rc.22 stateless Bearer access-token auth (login outage) - #69
Merged
Merged
Conversation
Users could not stay logged in after rc.22: QuantumNous#6329 replaced the dashboard session cookie with a stateless Bearer access-token + httpOnly refresh cookie, and the backend now authenticates dashboard requests ONLY via 'Authorization: Bearer <access_token>' (no cookie fallback). Aurora still authenticated by cookie, so every post-login request was unauthenticated. Port the upstream web/ scheme into aurora: - auth-store: hold accessToken/accessExpiresAt/session + setBundle/reset. - lib/auth-session.ts (new): single-flight refresh via /api/user/auth/refresh on a dedicated interceptor-free client (no recursion), app-boot bootstrap from the refresh cookie, and clearAuthentication. Transient (5xx/429/network) errors don't force sign-out. - lib/api.ts: request interceptor injects Bearer only when we hold a dashboard token and the request has no explicit Authorization (relay/API-key calls untouched); response interceptor does single-flight refresh + one retry on 401, else clears state and redirects to /sign-in. getCommonHeaders (SSE/ playground) also carries the Bearer token. - Capture the login bundle on every path: password, 2FA (keeps flow_token), passkey, OAuth, WeChat. - __root beforeLoad awaits bootstrapAuthentication so guards see the restored session on reload. Backend session JSON verified to match the frontend bundle parser. aurora build + typecheck clean (6 pre-existing warnings, no new).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
rc.22 的 QuantumNous#6329 把 dashboard 的 session cookie 换成无状态 Bearer access-token + refresh cookie,后端现在只认
Authorization: Bearer,无 cookie 回退。aurora 仍用 cookie 鉴权,所以登录后每个请求都未鉴权 → 登不进/登录态不保持。(#68 只修好了 2FA 的 flow_token,是登录链路的前半段;这个 PR 修后半段。)修复(照上游 web/ 方案移植,纯前端,仅改 aurora/)
POST /api/user/auth/refresh,专用无拦截器 client 防递归)、启动时从 refresh cookie 引导恢复、clearAuthentication;瞬时错误(5xx/429/网络)不强制登出。验证
规模
10 文件(1 新)。