I want to use the Google Dynamic Links APi client-side currently when I try to fetch data from the API through localhost I receive error:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://books.google.com/books?bibkeys=ISBN:0451526538&jscmd=viewapi. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 200.
here is my code
await fetch(`https://books.google.com/books?bibkeys=ISBN:0451526538&jscmd=viewapi`, {
method: 'GET',
mode: 'cors',
headers: {
'Access-Control-Allow-Origin':'*',
'Content-Type': 'application/json'
},
});
Now I want to access that API client-side as the
the documentation says but I can not fetch the data because of the cross-origin-policy