A password typed into the command line ends up in shell history and in the process list.
curl -u alice https://example.com/private/
With -u alice curl asks for the password without echoing it. -u alice:secret is visible to every user through ps while the command runs and stays in the history file. For scripts, put the login in ~/.netrc, with permissions 600, and use --netrc or -n. Basic authentication only encodes the password in base64, so use it over HTTPS.
Further reading: curl manual