I’m currently working on building a React book finder app that talks with Goodreads’ API. My backend skills are lacking so I wanted to undergo this project to improve on that. But I’m having trouble talking to Goodreads’ API; whenever I try to fetch a response and
console.log(...) it, I get a 401 (Unauthorized) Error:
In case its too hard to read, I seem to be getting the error because:
Access to fetch at ‘this URL’ from origin ‘my computer’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.
My first question is: How do I set the request’s mode to be ‘no-cors’?
My second question is: Is this recommended? Or is there a better, more sound way of getting past the 401 error?
At the end of the day, I just want to be able to display search results but I need to be able to draw from Goodreads’ API in order to display the data.
Thank you in advance!