Skip to content

Glossary: Next.js Beyond the Basics

requireUser and requireStaff

Also written: requireUser, requireStaff, getCurrentUser, isStaff

Helper functions that protect pages and server actions by checking who is signed in. `requireUser` redirects signed-out visitors to `/signin`, and `requireStaff` shows non-staff users the 404 page so outsiders can't tell staff pages exist.

Where the book teaches it

Related terms

Data access layerAuthorizationnotFound()