Next.js · Senior · Question 28 of 75

How do you connect forbidden() and unauthorized() to UI?

Explanation

The functions interrupt rendering and show the corresponding UI with 403 and 401 statuses - similar to notFound(). It's an experimental feature for now. Redirecting to login is done separately, via redirect().

Further reading

Problem with a question

Next.js · Senior · question 28

Test yourself

Take the Next.js · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz