Including API key in the header :(

In console, I get error
“Response to preflight request doesn’t pass access control check: It does not have HTTP ok status.”
I think this is the reason that the download has failed
I google it and now I know that this is the problem of CORS policy but I can’t find the solution of this.