opensea-js icon indicating copy to clipboard operation
opensea-js copied to clipboard

CORS error after invoking getOrder SDK method

Open Verrok opened this issue 4 years ago • 7 comments

Hello!

I issued with this when I try to invoke getOrder SDK method

Access to fetch at 'https://api.opensea.io/wyvern/v1/orders/?asset_contract_address=0x07bbdaf30e89ea3ecf6cadc80d6e7c4b0843c729&limit=1&side=1&token_id=63' from origin 'https://opensea.io' 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.

Does someone have the similar issue and/or it's fix?

Verrok avatar Dec 21 '21 18:12 Verrok

also getting cors error on open api's

faizan-karigar avatar Dec 21 '21 20:12 faizan-karigar

the same

amzfcy avatar Jan 06 '22 02:01 amzfcy

Having the same issue over here. Haven't been able to find a solution yet.

Haugen avatar Jan 13 '22 04:01 Haugen

Have you tried to set X-API-KEY in headers?

sayhicoelho avatar Feb 16 '22 20:02 sayhicoelho

Have you tried to set X-API-KEY in headers?

Forgot to close this issue. Sending requests with API keys works propeply

Verrok avatar Feb 16 '22 20:02 Verrok

@sayhicoelho @Verrok - how do we set the X-API-KEY if i'm calling directly using the SDK?

const orderResponse: Order = await seaport.api.getOrder({
  side: OrderSide.Sell,
  asset_contract_address: tokenAddress,
  token_id: tokenId,
});

allenchuang avatar Mar 03 '22 00:03 allenchuang

@sayhicoelho @Verrok - how do we set the X-API-KEY if i'm calling directly using the SDK?

const orderResponse: Order = await seaport.api.getOrder({
  side: OrderSide.Sell,
  asset_contract_address: tokenAddress,
  token_id: tokenId,
});

You need to specify apikey while you creating OpenSeaPort instance, e.g.

const seaport = new OpenSeaPort(window.ethereum, {
    networkName: "main",
    apiKey: "<your key>"
  })

Verrok avatar Mar 03 '22 08:03 Verrok