@ory/nextjs
Version:
This library was generated with [Nx](https://nx.dev).
103 lines (100 loc) • 4.39 kB
TypeScript
interface OryConfig {
/**
* Sets the base path for proxying requests to Ory during development and previews. Is unset per default for best
* compatibility.
*
* For example, Ory's `/self-service/login/browser` API will be proxied in your application at `/self-service/login/browser`.
* This proxying is only enabled in development and preview deployments and disabled in production.
*
* If you want to proxy Ory's `/self-service/login/browser` API at `/api/self-service/login/browser`, you can set this option to `/api`.
*/
proxyBasePath?: string;
/**
* Per default, this handler will strip the cookie domain from
* the Set-Cookie instruction which is recommended for most set ups.
*
* If you are running this app on a subdomain and you want the session and CSRF cookies
* to be valid for the whole TLD, you can use this setting to force a cookie domain.
*
* Please be aware that his method disables the `dontUseTldForCookieDomain` option.
*/
forceCookieDomain?: string;
/**
* 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[];
/**
* Override the default UI for login, registration, recovery, verification, and settings flows with a page
* in your project. This is useful if you want to customize the UI for these flows.
*/
override?: {
applicationName?: string;
/**
* Set this to use a custom login UI for the login flow. This path should be relative to the
* project root. Assuming you have a file at `./app/my-login/page.tsx`, you would set this to
* `/my-login`.
*/
loginUiPath?: string;
/**
* Set this to use a custom registration UI for the registration flow. This path should be relative to the
* project root. Assuming you have a file at `./app/my-registration/page.tsx`, you would set this to
* `/my-registration`.
*/
registrationUiPath?: string;
/**
* Set this to use a custom recovery UI for the recovery flow. This path should be relative to the
* project root. Assuming you have a file at `./app/my-recovery/page.tsx`, you would set this to
* `/my-recovery`.
*/
recoveryUiPath?: string;
/**
* Set this to use a custom verification UI for the verification flow. This path should be relative to the
* project root. Assuming you have a file at `./app/my-verification/page.tsx`, you would set this to
* `/my-verification`.
*/
verificationUiPath?: string;
/**
* Set this to use a custom settings UI for the settings flow. This path should be relative to the
* project root. Assuming you have a file at `./app/my-settings/page.tsx`, you would set this to
* `/my-settings`.
*/
settingsUiPath?: string;
/**
* Set this to use a custom default redirect URI. This path should be relative to your application's base URL.
*/
defaultRedirectUri?: string;
};
}
/**
* Enhances the Ory config with defaults and SDK URL. The SDK URL is determined as follows:
*
* 1. If `forceSdkUrl` is provided, it is used.
* 2. If `forceSdkUrl` is not provided, the following environment variables are checked:
* - `NEXT_PUBLIC_ORY_SDK_URL`
* - `ORY_SDK_URL`
* - `__NEXT_PRIVATE_ORIGIN` (if not in production)
* - `VERCEL_URL` (if not in production)
* - `window.location.origin` (if not in production)
* - If none of the above are set, an error is thrown.
*
* @param config - The Ory config to enhance
* @param forceSdkUrl - An optional URL to override the SDK URL. If not provided, the SDK URL is determined as described above.
*/
declare function enhanceOryConfig(config: Partial<OryConfig>, forceSdkUrl?: string): {
name: string;
sdk: {
url: string;
};
project: {
registration_enabled: boolean;
verification_enabled: boolean;
recovery_enabled: boolean;
recovery_ui_url: string;
registration_ui_url: string;
verification_ui_url: string;
login_ui_url: string;
};
};
export { type OryConfig, enhanceOryConfig };