Functions
Unauthorized interrupt and UI
This experimental interrupt represents missing or invalid authentication and requires experimental.authInterrupts. The custom UI receives no props. Do not use it to implement session verification; the caller must establish identity first. Example context: isolated Next.js 16.x candidate; snippet is partial unless it defines a complete convention file. Lifecycle: experimental. Expected behavior / verification: Test missing and expired sessions; no protected fields should be returned. Distinguish authenticated but forbidden requests. Do not use the interrupt in the root layout. Source: https://nextjs.org/docs/app/api-reference/functions/unauthorized Exact installed signature, typecheck and framework execution not run.
Formal Syntax & Structure
nextjs syntaxnextjs
unauthorized() from next/navigation; app/unauthorized.tsxWorking Example
Example Snippetnextjs
import { unauthorized } from 'next/navigation'; export function requireSession(valid: boolean){if(!valid) unauthorized()}