How to create a web session for one-time basic authentication

Just use UnityWebRequest and yield on the resulting object. See sample code in the docs.

As always, when debugging anything like this:

Networking, UnityWebRequest, WWW, Postman, curl, WebAPI, etc:

And setting up a proxy can be very helpful too, in order to compare traffic: