The route handler to protect.
Optionaloptions: ProtectApiAppOptionsOptional configuration controlling authentication and authorization behavior.
Returns a wrapped handler that enforces authentication (and optional authorization) before invoking the original handler.
Wraps a Pages Router API route handler and ensures that only authenticated (and optionally authorized) requests can access the route.
Intended for Next.js Pages Router API routes.
The route handler to protect.
Optionaloptions: ProtectApiPageOptionsOptional configuration controlling authentication and authorization behavior.
Returns a wrapped handler that enforces authentication (and optional authorization) before invoking the original handler.
Wraps an App Router API route handler and ensures that only authenticated (and optionally authorized) requests can access the route.
Intended for Next.js App Router Route Handlers.