Refactoring of external_auth.php complete.