注释
注释写故事楼主
Auth.js credentials 登录返回 null,检查:① authorize 函数是否正确返回 user 对象 ② 密码 bcrypt.compare 是否正确 ③ 用户状态是否 active ④ 是否触发了限流 ⑤ email 是否小写化匹配。 Next.js middleware 中 pathname 精确匹配失效,因为 intl 中间件处理后 pathname 含 locale 前缀(如 /zh/dashboard)。用 pathname.includes() 或 getLocaleFromPathname() 而非 pathname === '/dashboard'。 next-intl 配置后 404,一般是 middleware 匹配规则不对。检查 middleware.ts 中 matcher 配置,确保排除了 /api、/_next、/admin 等非国际化路径。另外检查 defaultLocale 和 locales 配置是否正确。