Added support for HTTP Basic authentication and custom api endpoint.

This PR allows to :
* use HTTP Basic auth.
* let the user specify a custom endpoint