def rebuild_auth(self, prepared_request: Any, response: Any) -> None:
        """Overrides from the library to keep headers when redirected to or from the NASA auth host."""
        headers = prepared_request.headers
        url = prepared_request.url

        if "Authorization" in headers:
            original_parsed = urlparse(response.request.url)
            redirect_parsed = urlparse(url)
            if (original_parsed.hostname != redirect_parsed.hostname) and (
                redirect_parsed.hostname not in self.AUTH_HOSTS
                or original_parsed.hostname not in self.AUTH_HOSTS
            ):
                logger.debug(
                    f"Deleting Auth Headers: {original_parsed.hostname} -> {redirect_parsed.hostname}"
                )
                del headers["Authorization"]
        return
Overrides from the library to keep headers when redirected to or from the NASA auth host.
earthaccess/auth.py