I'm currently diving into the world of Snipcart, and I'm encountering some issues connecting to your API. I'm using Next.js and haven't been able to find any solutions on the forum or in the documentation that address my specific problem. Whenever I make a call with getServerSideProps, I receive an unhandled rejection error stating: "Request failed with status code 404." It seems like I'm not authorized to connect, even though I've followed the steps provided in the docs and put in my secret API key. Here's a snippet of my code:
const secret = Buffer.from(process.env.SNIPCART_API_ID).toString('base64');
const url = 'https://api.snipcart.com/api/products';
const config = {
headers: {
'Content-Type': 'application/json',
Authorization: `Basic${secret}`,
},
};
axios.get(url, config).then((result) => {
console.log(result);
});
Any help or guidance would be greatly appreciated! 😁
Thanks!