I have a simple API call to make within Angular using the http client:
return this.http.get('https://api.someexternalapi.com').pipe(
map((response) => response),
catchError(error => of(this.handleError(error))));
I'm trying to make a call to a 3rd party API that I have no control over but I receive the following CORS error:
Access to XMLHttpRequest at 'https://api.someexternalapi.com' from origin 'http://localhost:4200' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
If I paste the request into postman it works.
What do I need to add to my Angular code to get around this?
I've had a look online and the examples are all setting the code on the server side which I have no access to.