Two gaps found while wiring auth into the data routes: 1. mcp_server/auth.py: HTTPBearer() defaults to auto_error=True, which rejects any request with no Authorization header before get_current_user's own "auth not configured -> allow as guest" check ever runs. That meant turning on Depends(get_current_user) anywhere 401'd every request even with auth fully disabled. Switched to auto_error=False and handle the missing-credentials case explicitly inside get_current_user instead. 2. Frontend never actually sent the stored token on data requests. auth.tsx only attached it to its own /api/auth/me check; api.ts's fetch() calls (chat, stats, documents, upload, delete) and every axios call elsewhere in the app (projects, kanban, hooks) had no Authorization header at all. Added an authHeaders() helper in api.ts, and a single axios request interceptor in auth.tsx that attaches the token app-wide since every component imports the same default axios instance. Known gap not addressed here: mcp_server/claude_code_mcp.py (the code-forge stdio MCP server) calls the REST API with no token at all. Harmless while auth is disabled (current state), but it will start getting 401'd the moment CLAUDE_OS_EMAIL/PASSWORD are actually set - needs a service-token bypass if that's ever turned on. |
||
|---|---|---|
| .. | ||
| e2e | ||
| public | ||
| src | ||
| test-results | ||
| .gitignore | ||
| eslint.config.js | ||
| index.html | ||
| package-lock.json | ||
| package.json | ||
| playwright.config.ts | ||
| postcss.config.js | ||
| README.md | ||
| tailwind.config.js | ||
| tsconfig.app.json | ||
| tsconfig.json | ||
| tsconfig.node.json | ||
| vite.config.ts | ||
React + TypeScript + Vite
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- @vitejs/plugin-react uses Babel (or oxc when used in rolldown-vite) for Fast Refresh
- @vitejs/plugin-react-swc uses SWC for Fast Refresh
React Compiler
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see this documentation.
Expanding the ESLint configuration
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Remove tseslint.configs.recommended and replace with this
tseslint.configs.recommendedTypeChecked,
// Alternatively, use this for stricter rules
tseslint.configs.strictTypeChecked,
// Optionally, add this for stylistic rules
tseslint.configs.stylisticTypeChecked,
// Other configs...
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])
You can also install eslint-plugin-react-x and eslint-plugin-react-dom for React-specific lint rules:
// eslint.config.js
import reactX from 'eslint-plugin-react-x'
import reactDom from 'eslint-plugin-react-dom'
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Enable lint rules for React
reactX.configs['recommended-typescript'],
// Enable lint rules for React DOM
reactDom.configs.recommended,
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])