To request a resource over HTTP using Basic Authentication, you need to construct and add the Authorization
header line to the request as described in the linked document.
Basically, you add a header line to the request. The name of the field is Authorization
and the value is the auth type followed by a space and then the base64 encoded string of the username:password
.
So for e.g. if the username is John and the password is secret, you would form a string:
John:secret
and then base64 encode it which will result in:
Sm9objpzZWNyZXQ=
So the full header line to add to the request looks like this:
Authorization: Basic Sm9objpzZWNyZXQ=
Hope this helps.