Connect with username password

I am using the mongoose-6.18 with mongoose-OS-1.8.0 on ESP8266 device.

I located the example to connect to a HTTPS site.
Now, I need to connect the site with username, password.

Any example to do it with
mg_connect_http() or mg_connect_http_opt()

Thanks

Do you mean to connect with a Basic auth header?

Yes. I manage to find the info from the Server which I trying to connect using “mg_connect_http()”

httpConn = mg_connect_http(mgos_get_mgr(), MG_CB(HttpEvent_cb, “POST event”),
url, header, post);

header : “Content-Type: application/x-www-form-urlencoded\r\n”
post : “username=xxxxx&password=xxxxx”