1

I want to add username and password in post url with basic authentication

http://IPaddress:port/F1/Details { Body }

try topray
  • 11
  • 5

1 Answers1

1

Your not specified the programming language but if you are using c# it will be like this:

HttpClient client = new HttpClient();

        var byteArray = Encoding.ASCII.GetBytes("username:password");
        client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
        client.PostAsync("http://IPaddress:port/F1/Details", yourcontent);

Using Postman enter image description here

  • thank u but i want to use it without put it in user/password's case soething like : http://IPaddress:port/F1/Details/user/password.. – try topray Sep 06 '18 at 11:45
  • you can post them with parameters like http://IPaddress:port/F1/Details?username=test&password=pass and update the Action in the controller to receive them. – Mohd Shakhtour Sep 06 '18 at 11:50
  • Post : http://162.15.44.25:8080/interfaces/inventory/getDetails?username=admin&password=Mypassword – try topray Sep 06 '18 at 13:43