Change path.exists to fs.exists
Fix basic auth validation