I'm creating a web based platform with Angular that interacts with the Magic Eden API (documentation: https://api.magiceden.dev/).
Please keep in mind this is not my API, I'm merely making calls to it from my front end.
When I make API calls to the API through the Angular HTTP Client I get the a CORS error stating "No 'Access-Control-Allow-Origin' header is present on the requested resource."
However, when I make the calls through Postman it works without any issue.
I have tried adding the 'Access-Control-Allow-Origin' header in the following 2 ways:
1)
headers = new HttpHeaders().set('Access-Control-Allow-Origin', '**');
getListings(symbol: string)
{
return this.http.get('https://api-mainnet.magiceden.dev/v2/collections/aos/listings?offset=0&limit=18', {headers: httpOptions.headers});
}
const httpOptions = {
headers: new HttpHeaders ({
"Access-Control-Allow-Origin": "**"
})
}
getListings(symbol: string)
{
return this.http.get('https://api-mainnet.magiceden.dev/v2/collections/aos/listings?offset=0&limit=18', httpOptions);
}
I have also tried setting the Access-Control-Allow-Origin to "*" and "**" which didn't work.
I also tried making the calls with Axiom instead of the Angular HttpClient and I still get the same error.
Does anyone know how to approach this? Any assistance would be appreciated!