Curl is a powerful command line tool for interacting with web servers. One of the common tasks you might need to perform is sending Basic Authentication credentials. Basic Authentication is a simple authentication scheme built into the HTTP protocol. This tutorial explains how to send HTTP Basic Authentication credentials with a Curl.
To send HTTP Basic Authentication credentials, use the -u
or --user
option followed by username and password separated by a colon (:
) character:
curl -u admin:psw https://httpbin.org/basic-auth/admin/psw
curl --user admin:psw https://httpbin.org/basic-auth/admin/psw
When using HTTP Basic Authentication, make sure that the site supports HTTPS to avoid exposing your credentials to potential eavesdroppers during transmission. Encrypting the communication ensures that your sensitive information is securely transmitted over the network.
Leave a Comment
Cancel reply