add ensureAuth middleware to clients