I have an azure static web page setup and want to communicate with my Azure Table service through REST API, which I was told would be possible.
This is what my fetch code block looks like:
fetch('https://storagename.table.core.windows.net/Tables', {
method: 'GET',
mode: 'cors',
headers: {
'Accept': '*/*',
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': '*',
'Authorization': `SharedKey storagename:${sigBase64}`,
'Date': date.toUTCString(),
'x-ms-version': '2019-02-02',
'DataServiceVersion': '3.0;NetFx',
},
redirect: 'follow'
}).then(function(response){
if (response.ok){
return response.json();
}else{
return Promise.reject(response);
}
}).then(function(data){
console.log(data);
})
On my Azure Table settings under Resources, I've enabled CORS for all domains (*).
I'm a little confused as to what troubleshooting I can try next. I'm assuming there is some CORS policy or header I'm missing but the 403 return message doesn't help too much.
Does anyone have an idea of what I should look into next?
After a while I figured out how to properly authorize my requests through the Shared Key signature. I validated this by using Postman and sending a simple GET request with the correct Date/Authorization headers, and get a 200 response.