So the bit of the code where that error is raised is here in lib lib/apiauthaction.php if ($required && $this->auth_user instanceof User) {[…]