fix: 登录接口彻底跳过鉴权,消除 403 权限不足

ClubWechatLoginView / WechatMiniProgramLoginView 覆盖 initial,不做 JWT/权限/限流;动态配置接口也不再解析坏 Token。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
XingQue
2026-07-23 01:11:18 +08:00
parent c37d66745b
commit 97e9093aa5
3 changed files with 19 additions and 5 deletions

View File

@@ -48,10 +48,18 @@ class ClubWechatLoginView(APIView):
多俱乐部微信小程序登录(新接口,旧 /yonghu/wechatlogin 不变)。
POST /jituan/auth/wechat-login
body: { code, club_id?, app_id? }
注意:必须完全跳过 JWT/权限/限流。
DRF 在 authentication_classes=[] 时若仍抛 AuthenticationFailed
会因无 WWW-Authenticate 头被改写成 HTTP 403前端显示「权限不足」
"""
authentication_classes = [] # 登录不走 JWT避免旧 Token 触发 403
throttle_classes = [AnonRateThrottle]
permission_classes = [AllowAny]
authentication_classes = ()
permission_classes = ()
throttle_classes = ()
def initial(self, request, *args, **kwargs):
# 登录接口不做任何鉴权/权限/限流,避免 403「权限不足」
return
def post(self, request):
code = (request.data.get('code') or '').strip()