Files
OpenFrame/app/api/auth/[...nextauth]/route.ts
T
Yusuf İpek 6e8170d080 feat(api): Implement API response Cache-Control
- Introduce `withCacheControl` utility function for API responses.
- Apply `private, no-store` to authentication and data modification (POST, PATCH, DELETE) routes.
- Apply `private, no-cache` to sensitive data retrieval (GET) routes.
- Enhance security by preventing caching of private user data.
- Ensure fresh data is always fetched for authenticated API responses.
2026-02-07 16:51:46 +03:00

15 lines
544 B
TypeScript

import { handlers } from '@/lib/auth';
import { rateLimit } from '@/lib/rate-limit';
import { withCacheControl } from '@/lib/api-response';
export const { GET } = handlers;
// Wrap NextAuth POST with login rate limiting
export async function POST(request: Request) {
const limited = await rateLimit(request, 'login');
if (limited) return limited;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const response = await handlers.POST(request as any);
return withCacheControl(response, 'private, no-store');
}