Heya
trying to connect to the web services via javascript. Having a really hard time succeeding. Keeps giving me a cors error. Wonder - Is it possible to connect to it with a query param instead of a header param? My experience is, that it is a lot easier. Example:
localhost:endpoint/username=xxxxx&password=&&&&&&
Currently I'm doing as follows (but i keep getting 401 even though I'm certain the credentials are correct.):
<script>
async function getUser() {
try {
const response = await fetch("">xxxxx.dv.local:7048/.../xxxxxxx", {
method: 'GET',
mode: 'no-cors',
headers: {
accept: 'application/json',
'Authorization': 'Basic '+btoa('xxxxxx:xxxxxxx.')
},
});
if (!response.ok) {
throw new Error(`Error! status: ${response.status}`);
}
const result = await response.json();
console.log(result)
return result;
} catch (err) {
console.log(err);
}
}
getUser();
</script>