Hi. I'm trying to test a client app for Genesys Cloud. The code is hosted in Github. At a certain point the code does an API call to knowledge export jobs, that returns an URL for downloading the result of the Job. I can get the URL correctly. The problem is when trying to download the results from that URL. I get this error:
Access to fetch at 'https://knowledge-prod-euw1-......' from origin 'https://xxxxxxxx' 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.
Why is that? My app is using implicit grant, and the origin trying to access the AWS URL is the same one configured as redirect URL. The only nuance here is that my redirect URL looks like https://xxxxxxxx/yyyy, al the origin mentioned in the error above is just https://xxxxxxxx
Are other API requests made by the app working, just not this one? If that's the case, the cause is usually that you've malformed the request in such a way that the API server was unable to interpret it successfully, so it was unable to match the request to a known resource, so it was unable to know how to validate the auth on the resource, so it was unable to know which domains are allowed for CORS, so it didn't send any CORS headers.
The best way to troubleshoot this is to copy the request from the browser as a cURL command and run it in a shell terminal. Only browsers care about CORS, so you'll be able to see the full response in the terminal for troubleshooting. If the response you're getting doesn't help you fix the issue, please post the CURL command and response here, including the correlation ID from the response but redacting any sensitive info like your auth token and any PII.
Yes, the other API requests are working fine, but this is only case in which I have to access to an AWS URL returned by a completed job. If I copy/paste that URL and put it into the browser, the file gets downloaded, but when my code tries to do so, I get the CORS error
Oh, sorry I misread and thought you were talking about an API request. Please open a case with Care to investigate the issue with the other URL that's not the API.