function requireAuth requireAuth(): MiddlewareFunction Guard that requires authentication. Returns 401 if no principal. Examples Example 1 app.router.get('/protected', { middleware: [requireAuth()], handler }); Return Type MiddlewareFunction Middleware function