error when use an image hosted in amazon web services in angularjs [duplicate]

This question already has an answer here:

am currently connecting to payment method called conekta, the problem appears when receive the answer to the payment request, it returns to url of a barcode image hosted in aws but it throws the following error:

has been blocked by CORS policy: No ‘ Access-Control-Allow-Origin
‘header is present on the requested resource

link to image

This happens both on localhost and on my client’s server (heroku)
but I only have access to the frontend with angularjs,try accessing https but it does not work so I’ve been trying several things but I still do not come up with a solution for example using fileReader.

any ideas to solve this?

function toDataUrl(url, callback) {
    var xhr = new XMLHttpRequest();
    xhr.onload = function() {
        var reader = new FileReader();
        reader.onloadend = function() {
    };'GET', url);
    xhr.responseType = 'blob';
toDataUrl(document.getElementById('barcode').src, function(myBase64) {
    console.log(myBase64); // myBase64 is the base64 string

Source: AngularJS