beforeInsert hook and fetch

Have you tried to put authentication into headers?

headers: {
	'Content-Type':'application/json',
	'Authorization':'Basic '+btoa(username+":"+password)
}

I don’t, know if WixCode has the btoa() function, but try it first.