I didn’t think of using fetch, It’s the same problem but fetch returns a better error information !
The error was that capacitor://localhost was not allowed by origin.
I was able to realize that my CORS configuration was not good
let x = encode(user_and_password)
console.log("encoded")
try {
let response = await fetch(url , // https url
{
method: 'GET',
headers: {
'Authorization': 'Basic ' + x,
"Content-Type": "application/json",
}
}
)
console.log("back from fetch , status=" + response.status)
if (response.status !== 200) {
console.log('Looks like there was a problem. Status Code: ' +
response.status);
return;
}
console.log("back from fetch , read data=" + response.status)
// Examine the text in the response
response.json().then(function (data) {
console.log(data);
this.$router.push({ name: "Select", params: { gender: this.config.gender, devices: data } })
});
} catch (error) {
console.log("error="+JSON.stringify(error))
}
I see in the xcode log
⚡️ [log] - encoded
⚡️ [log] - error={}
ionic 6 Vue.
doing the get with curl on the mac system works ok.
connecting to the base url on the phone via safari works ok. (phone only wifi connected)
local network in info.plist, but don’t get prompt.