API Post Requests Return Unauthenticated?

Thanks for answering! I managed to solve it without the need for Wireshark/tcpdump.

For anyone encountering a similar problem, somehow I solved it by using the other way to make POST requests in axios:

var config = {
    'Content-Type': 'application/json',
    'X-Metabase-Session': session_token     
};
var axiosOptions = {
    method: 'POST',
    url: 'http://localhost:3000/api/card/1/query',
    headers: config
};
axios(axiosOptions).then(response => {
    console.log(response.data);
}).catch(err => {
    console.log(err);
});

To be honest, I’m not sure why this works and axios.post() doesn’t, but it worked for me!

1 Like