def login(
        self,
        strategy: str = "netrc",
        persist: bool = False,
        system: Optional[System] = None,
    ) -> Any:
        """Authenticate with Earthdata login.

        Parameters:
            strategy:
                The authentication method.

                * **"interactive"**: Enter a username and password.
                * **"netrc"**: (default) Retrieve a username and password from ~/.netrc.
                * **"environment"**:
                    Retrieve a username and password from $EARTHDATA_USERNAME and $EARTHDATA_PASSWORD.
            persist: Will persist credentials in a `.netrc` file.
            system: the EDL endpoint to log in to Earthdata, defaults to PROD

        Returns:
            An instance of Auth.

        Raises:
            LoginAttemptFailure: If the NASA Earthdata Login service rejects
                credentials.
        """
        if system is not None:
            self._set_earthdata_system(system)

        if self.authenticated and (system == self.system):
            logger.debug("We are already authenticated with NASA EDL")
            return self

        if strategy == "interactive":
            self._interactive(persist)
        elif strategy == "netrc":
            self._netrc()
        elif strategy == "environment":
            self._environment()

        return self
Authenticate with Earthdata login.

        Parameters:
            strategy:
                The authentication method.

                * **"interactive"**: Enter a username and password.
                * **"netrc"**: (default) Retrieve a username and password from ~/.netrc.
                * **"environment"**:
                    Retrieve a username and password from $EARTHDATA_USERNAME and $EARTHDATA_PASSWORD.
            persist: Will persist credentials in a `.netrc` file.
            system: the EDL endpoint to log in to Earthdata, defaults to PROD

        Returns:
            An instance of Auth.

        Raises:
            LoginAttemptFailure: If the NASA Earthdata Login service rejects
                credentials.
        
earthaccess/auth.py