curl -u [Curl/Bash Code]

To send a Curl request with a Basic Server Authentication, you need to send an HTTP request to the server and provide user credentials using the -u or --- user command-line parameter. Curl has a built-in mechanism for sending basic authorization to the server. You need to pass in the username and password with -u parameter, and Curl will generate the correct HTTP Authentication request by itself. Click Run to execute the Curl request with the Credentials and see the results. The Curl/Bash code was automatically generated for the Curl example.
curl -u [Curl/Bash Code] Run
curl -u "login:password" https://reqbin.com/echo/get/json  
Updated: Viewed: 11008 times
Curl/Bash code for Curl example

Curl/Bash code for Curl Example

This Curl/Bash code snippet was generated automatically for the Curl example.
<< Back to the Curl example

What is Curl?

Curl is a command-line utility with a cross-platform library (libcurl) for transferring data between servers, designed to work without user intervention. Curl can upload or download data, submit web forms, and make API requests using over 25 protocols, including HTTP, HTTPS, FTP, and SFTP. Curl has built-in support for HTTP Cookies, certificate validation, SSL, user authentication and is available on all modern platforms, including Linux, Windows, and Mac.

What is HTTP Authorization?

HTTP authorization is a built-in mechanism for user authentication and access control to protected resources. HTTP authorization is performed by sending authentication credentials in the Authorization header to authenticate the HTTP client on the server.

What is Basic Authorization?

Basic authorization is the method by which an HTTP client (web browser or mobile app) provides a username and password in the HTTP Authorization header when requesting a resource from the server. For basic HTTP authentication, the request contains a header field in the form "Authorization: Basic {base64string}" where the credentials are Base64 encoded username and password, concatenated with a single colon ":"

Authorization Header Syntax
Authorization: Basic {base64string}

How to send the Basic Authentication data using Curl?

To send a Curl request with Basic Authorization credentials, you can use the -u (or --user) command line parameter:

Curl Basic Authentication Syntax
curl -u "login:password" [URL]

Where:
  • -u: specifies the username and password that will be used to authenticate the server.

See also

Generate code snippets for Curl/Bash and other programming languages

Convert your Curl request to the PHP, JavaScript/AJAX, Curl/Bash, Python, Java, C#/.NET code snippets using the Curl/Bash code generator.