@ory/nextjs
Version:
This package contains the Next.js SDK for Ory. It provides a set of React components, server-side components, and hooks to interact with the Ory ecosystem. Supports both app and page routers.
30 lines (27 loc) • 993 B
TypeScript
import { NextRequest, NextResponse } from 'next/server';
import { AccountExperienceConfiguration } from '@ory/client-fetch';
/**
*
*/
type OryMiddlewareOptions = {
/**
* Per default headers are filtered to forward only a fixed list.
*
* If you need to forward additional headers you can use this setting to define them.
*/
forwardAdditionalHeaders?: string[];
forceCookieDomain?: string;
project?: Partial<AccountExperienceConfiguration>;
};
/**
* Creates a Next.js middleware function that proxies requests to the Ory SDK.
*
* This middleware function intercepts requests to the Ory SDK and rewrites the URLs if
* in development mode or on vercel.com domains.
*
* @param options - The Ory configuration to use for the middleware.
* @returns The Ory Next.js middleware function
* @public
*/
declare function createOryMiddleware(options: OryMiddlewareOptions): (r: NextRequest) => Promise<NextResponse<unknown>>;
export { createOryMiddleware };