Creates a Next.js catch-all auth route handler (Pages Router and App Router) for the built-in routes (/signin, /callback, /userinfo, /signout).
Mount this handler on a catch-all route (e.g. /api/auth/[...monocloud]).
If you already useauthMiddleware(), you typically don’t need this handler. UsemonoCloudAuth()when middleware cannot be used or when auth routes need customization.
| Parameter | Type | Description |
|---|---|---|
options? | MonoCloudAuthOptions | Optional configuration for the auth handler. |
Returns a Next.js-compatible handler for App Router route handlers or Pages Router API routes.
import { monoCloudAuth } from "@monocloud/auth-nextjs";
export const GET = monoCloudAuth();