Using the multi download button doesn't work when used at the beginning of the day
Problem
Downloading multiple attachments at the start of the day using the "multi download" button doesn't work as expected. The contents of the files downloaded will contain HTML - and the actual DOM will contain references to unauthenticated
.
This happens under the following circumstances:
- Zendesk is in Agent Workspace mode with private attachments enabled
Workaround
- Download a single attachment at the start of the day, and then all subsequent "multi download" requests will work
- In another tab, visit
https://<ZD_SUBDOMAIN>.zendesk.com/auth/v2/login/signin
and wait for the redirects to complete. All subsequent "multi download" requests will work
Cause
For some reason, Zendesk requires an additional auth check when initiating the first download which causes several redirects. The redirects don't play nice with the extension, and to make it more troublesome it doesn't look like we have a cookie or any state on the client end that indicates that we are authorised for attachments.
If an authorisation check is needed, a typical download will go through this phase:
https://support.<ZD_SUBDOMAIN>.com/attachments/token/<TOKEN>/?name=Screenshot+2023-09-05+at+2.25.00+PM.png
↓↓↓
https://support.<ZD_SUBDOMAIN>.com/access/unauthenticated
↓↓↓
https://support.<ZD_SUBDOMAIN>.com/auth/v2/login/signin
↓↓↓
https://support.<ZD_SUBDOMAIN>.com/attachments/token/<TOKEN>/?name=Screenshot+2023-09-05+at+2.25.00+PM.png
The extension currently will get stuck at the second link and download the unauthenticated page HTML.
Once the first download has been authorised correctly, subsequent attachments download without any issues.