I'm developing an iCalendar / calendar invite Zendesk Apps Framework app, and running into issues grabbing calendar invite attachments in Zendesk support tickets.
I'm trying to request attachments using the ZAF client. As per the docs here, it says CORS can be added to the ZAFClient.request() method by specifying cors: true or cors:false in the headers, as per:
However, that doesn't make much sense as it's the response that should have the CORS information for the browser, not the request.
It doesn't look like the attachments endpoint actually has the content for the attachment. The actual attachment is a Redirect from <subdomain>.zendesk.com/attachments/token/<tokenID> to a asset store at https://p20.zdusercontent.com/attachment/. This is thus technically a cross-site request.
There appears to be only a single other thread about this, here: https://support.zendesk.com/hc/en-us/community/posts/4408861005722-CORS-error-when-fetch-internal-attachment-using-attachment-contentUrl and it just has a generic link back to the CORS information page.
As per the helpdesk article here: https://support.zendesk.com/hc/en-us/articles/4408881672730 it says the ZAF Client .request() method should actually be used in order to avoid CORS issues, since it acts as a proxy (thus avoiding the browser's CORS checking). It says it does not support binary files, though I am trying to pull text attachments, though that may not matter to it.