BUG: Silent 401 handling does not redirect user to login

未关闭
#285 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

@mahek2016 已经在做这个了。

开始于 2026年2月21日。

  • #286 来自 @mahek2016 —— 未关闭

评估

难度
3/5
预计耗时
1-2 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
supabase

调研方向

从 issue 中描述的 Axios 响应拦截器开始,追踪身份验证/会话状态的存储方式,以及如何执行到 /login 的导航。复现一个使用过期 token 的请求,然后验证明确的 401 是否通过 Supabase signOut 或等效方式清除会话,并重定向到 /login 或显示清晰的会话已过期反馈。

由索引模型根据 Issue 内容生成。

描述

Is there an existing issue for this?
  • I have searched the existing issues
What happened?

📌 Issue Overview

When an API request returns a 401 Unauthorized response, the frontend only logs an error in the console and does not provide any visible feedback or redirect to the login page.


🔍 Current Behavior

  • Axios interceptor catches 401
  • Console logs "Unauthorized request"
  • User remains on the same page
  • UI appears broken (data not loading, buttons failing)
  • No redirection or session reset occurs

✅ Expected Behavior

  • On a definitive 401 response:
    • Clear authentication/session state
    • Redirect user to /login
    • OR display a clear “Session expired” message

🧪 Steps to Reproduce

  1. Login normally
  2. Expire the token manually or clear auth storage
  3. Trigger any protected API call (dashboard, analytics, etc.)
  4. Observe that console logs error but no redirect or UI feedback occurs

🎯 Impact

This affects production readiness and user experience.

When sessions expire:

  • Users experience broken UI behavior
  • No guidance is provided
  • App appears unstable

💡 Suggested Direction

In the Axios response interceptor:

  • Trigger a global logout (Supabase signOut or equivalent)
  • Redirect to /login
  • Optionally show a “Session expired” notification
Record
  • I agree to follow this project's Code of Conduct
  • I want to work on this issue
主要语言
Python
星标
103
派生
143
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

AOSSIE-Org/Devr.AI 的其他 Issue

查看 AOSSIE-Org/Devr.AI 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。