Basic Authentication it’s often used as a simple security measure or as a temporary authentication method while developing with certain APIs.
While the WordPress HTTP API doesn’t have explicit support for basic authentication, it’s still possible to use it as a header:
$request = wp_remote_post( $remote_api_endpoint, array( 'body' => array( 'foo' => 'bar' ), 'headers' => array( 'Authorization' => 'Basic '. base64_encode( $username .':'. $password ) ) ) );
Remember that if you’re sending an unencrypted request, all the headers will be sent in plain text, so you should only use it over HTTPS.