Azure Table REST API / 403 (Server failed to authenticate the request. Works in Postman but not on static web page

Darren Uong 0 Reputation points
2024-03-18T21:14:42.0666667+00:00

Hi all.

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.

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.

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?

Azure Table Storage
Azure Table Storage
An Azure service that stores structured NoSQL data in the cloud.
156 questions
Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
2,714 questions
Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
768 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Nehruji R 2,051 Reputation points Microsoft Vendor
    2024-03-19T10:19:23.64+00:00

    Hello Darren,

    Thank you for reaching out to Microsoft Q&A forum.

    I understand that you were having issues with Azure Storage REST API with Shared Key which was giving you 403 errors. The error message indicates that the server failed to authenticate the request, suggesting that there might be an issue with the Authorization header.

    You can try troubleshooting this issue by following below checks,

    Please let us know if you have any further queries. I’m happy to assist you further.


    Please "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

    0 comments No comments