Skip to content

authInterrupts

Source URL: https://nextjs.org/docs/app/api-reference/config/next-config-js/authInterrupts

This feature is currently available in the canary channel and subject to change.

The authInterrupts configuration option allows you to use forbidden and unauthorized APIs in your application. While these functions are experimental, you must enable the authInterrupts option in your next.config.js file to use them:

import type { NextConfig } from 'next'
const nextConfig: NextConfig = {
experimental: {
authInterrupts: true,
},
}
export default nextConfig
module.exports = {
experimental: {
authInterrupts: true,
},
}
  • forbidden
    • API Reference for the forbidden function.
  • unauthorized
    • API Reference for the unauthorized function.
  • forbidden.js
    • API reference for the forbidden.js special file.
  • unauthorized.js
    • API reference for the unauthorized.js special file.