Getting Blocked By CORS (Api for opensea testnets)
Access to fetch at 'https://testnets-api.opensea.io/assets?asset_contract_address=0xdadd397c13b5a74566E939754CAaFd6E8aF7eCd0&order_direction=asc' from origin 'https://nft-toast.netlify.app' 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.
Here is the code with my fetch for the api request.
Trying to call from
const response = await fetch(
"https://testnets-api.opensea.io/assets?asset_contract_address=0xdadd397c13b5a74566E939754CAaFd6E8aF7eCd0&order_direction=asc"
).then((res) => res.json());
Thanks!
I'm getting the same issue using api.opensea.io. Making API calls works fine on localhost, but as soon as I deploy to a server I get the same has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. error.
Any additional headers we need to send here? I can't figure out how I need to configure my request for this to work.
Same issue here. Requests from localhost are being blocked by CORS. Any solutions or does this require opensea to make changes on their end?
Same issue here
Hello, please make sure you are using a valid api key and check this. iIt might be a problem with your requests. It says that it failed from the access control (CORS) header on the request.
Also check this solution: https://github.com/ProjectOpenSea/opensea-js/issues/285#issuecomment-1008575614
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment.