This document outlines testing steps for the dashboard authentication handling implementation (Issue #414).
-
src/mcp_memory_service/web/static/app.js
- Added
authStateproperty to constructor - Added
detectAuthRequirement()method - Modified
init()to detect auth before loading data - Updated
apiCall()to include authentication headers - Added
handleAuthFailure()method - Added
showAuthModal()method - Added
authenticateWithApiKey()method - Added
setupAuthListeners()method
- Added
-
src/mcp_memory_service/web/static/index.html
- Added authentication modal HTML with API key and OAuth options
-
src/mcp_memory_service/web/static/style.css
- Added authentication modal styles (light and dark mode)
- Set
MCP_ALLOW_ANONYMOUS_ACCESS=truein environment - Start HTTP server:
python scripts/server/run_http_server.py - Open dashboard in browser: http://localhost:8000
- Verify: Dashboard loads without showing auth modal
- Verify: All operations work (add memory, search, etc.)
- Remove or set
MCP_ALLOW_ANONYMOUS_ACCESS=false - Set
MCP_API_KEY=test-api-key-12345in environment - Restart HTTP server
- Open dashboard in browser: http://localhost:8000
- Verify: Auth modal appears automatically
- Test invalid key:
- Enter wrong API key
- Click "Authenticate"
- Verify: Error toast appears
- Verify: Auth modal remains open
- Test valid key:
- Enter
test-api-key-12345 - Click "Authenticate"
- Verify: Success toast appears
- Verify: Auth modal closes
- Verify: Dashboard data loads
- Verify: All operations work
- Enter
- After successful authentication, refresh the page
- Verify: Auth modal does not appear (key stored in localStorage)
- Verify: Dashboard loads immediately
- Open browser DevTools > Application > Local Storage
- Verify:
mcp_api_keyis present with correct value
- Authenticate successfully
- In DevTools console, run:
localStorage.removeItem('mcp_api_key') - Try to add a new memory or perform search
- Verify: Auth modal reappears
- Re-authenticate
- Verify: Operation can be retried
- Trigger auth modal
- Type API key in input field
- Press Enter key (don't click button)
- Verify: Authentication attempt is made
- Trigger auth modal
- Click "Login with OAuth" button
- Verify: Browser redirects to
/oauth/authorize - (OAuth flow testing requires OAuth server setup - out of scope for this test)
- Open dashboard
- Click Settings (gear icon)
- Change theme to Dark
- Trigger auth modal (clear localStorage or use unauthenticated mode)
- Verify: Auth modal uses dark theme styles
- Verify: Text is readable
- Verify: Input fields use dark background
- Open DevTools > Toggle device toolbar
- Select mobile viewport (e.g., iPhone 12)
- Trigger auth modal
- Verify: Modal is responsive and usable on mobile
- Verify: Input fields are properly sized
- Verify: Buttons are touch-friendly
- Open auth modal
- Press Tab key repeatedly
- Verify: Focus moves through interactive elements in logical order
- Verify: API key input can be focused and typed in
- Verify: Buttons can be activated with Enter/Space
- Network failure simulation:
- Open DevTools > Network tab
- Set throttling to "Offline"
- Try to authenticate
- Verify: Error is handled gracefully
- Verify: User sees appropriate error message
# Test 1: Anonymous access
export MCP_ALLOW_ANONYMOUS_ACCESS=true
python scripts/server/run_http_server.py
# Test 2: API key required
unset MCP_ALLOW_ANONYMOUS_ACCESS
export MCP_API_KEY=test-api-key-12345
python scripts/server/run_http_server.py
# Test 3: Check localStorage in browser console
localStorage.getItem('mcp_api_key')
# Test 4: Clear stored credentials
localStorage.removeItem('mcp_api_key')
localStorage.removeItem('mcp_oauth_token')- ✅ Auth modal appears when authentication is required
- ✅ Users can authenticate with API key
- ✅ Credentials persist across page refreshes
- ✅ 401 errors trigger re-authentication
- ✅ All UI elements are styled consistently
- ✅ Dark mode works correctly
- ✅ No JavaScript errors in console
- OAuth flow requires full OAuth server setup (tested separately)
- OAuth token refresh not implemented (future enhancement)
- Multi-factor authentication not supported
After implementation, verify these existing features still work:
- Memory search (semantic, tag-based, time-based)
- Add/edit/delete memories
- Settings modal
- Document upload
- Graph visualization
- Dark mode toggle
- Language switching (i18n)
- Auth detection adds one extra
/api/healthcall on page load - LocalStorage read/write operations are synchronous but negligible
- No performance degradation expected for normal operations
- API keys stored in localStorage (client-side only)
- Not encrypted (acceptable for local development)
- Production deployments should use HTTPS
- OAuth tokens expire according to server configuration
- Add OAuth token refresh logic
- Implement "Remember me" checkbox
- Add logout button to clear credentials
- Support multiple authentication providers
- Add session timeout handling
- Implement two-factor authentication