Rest API basic auth not working

The REST API does not support basic authentication out of the box, you need a plugin. The documentation points to this one, accompanied by this warning:

Note that this plugin requires sending your username and password with every request, and should only be used for development and testing i.e. not in a production environment.