Files
accounted/middleware.ts
T
Jakob Wennberg ff33b5a5c0 fix: exclude .well-known from auth middleware for MCP OAuth discovery (#76)
The .well-known/oauth-protected-resource and oauth-authorization-server
routes were caught by the auth middleware and redirected to /login,
preventing Claude Desktop from discovering the OAuth endpoints.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 15:32:52 +01:00

21 lines
736 B
TypeScript

import { type NextRequest } from 'next/server'
import { updateSession } from '@/lib/supabase/middleware'
export async function middleware(request: NextRequest) {
return await updateSession(request)
}
export const config = {
matcher: [
/*
* Match all request paths except for the ones starting with:
* - _next/static (static files)
* - _next/image (image optimization files)
* - favicon.ico (favicon file)
* - api (API routes - they handle their own auth)
* - Static assets (images, scripts, manifest, icons, etc.)
*/
'/((?!_next/static|_next/image|favicon.ico|api|\\.well-known|sw\\.js|sw-register\\.js|manifest\\.json|icons/|.*\\.(?:svg|png|jpg|jpeg|gif|webp|ico|js|json)$).*)',
],
}