Search code examples
httpcurlgetpostman

HTTP Authentication equivalent for cURL username:password


Is there a way to convert the following curl into an normal http request?

curl --user <username>:<password> https://{username}.fred.sensetecnic.com/api/{custom_endpoint_name}

Into something like this (using Postman for the http requests)

GET https://{username}.fred.sensetecnic.com/api/{custom_endpoint_name}

Headers: Username: username, Password: password

Solution

  • Use Basic Auth provided in postman.

    1. Goto Authorization tab.
    2. Select Basic Auth from Type dropdown list.
    3. Add username and password.
    4. Click Update request(if applicable).

    enter image description here


    Note: For this to work, server must accept json encoded credentials.

    1. Click on Headers.
    2. Select Content type
    3. Add key-value pairs, Username and Password

      enter image description here