unauthorized.js
The unauthorized file is used to render UI when the unauthorized
function is invoked during authentication. Along with allowing you to customize the UI, Next.js will return a 401
status code.
Reference
Props
unauthorized.js
components do not accept any props.
Examples
Displaying login UI to unauthenticated users
You can use unauthorized
function to render the unauthorized.js
file with a login UI.
Version History
Version | Changes |
---|---|
v15.1.0 | unauthorized.js introduced. |