Error downloading invoices when clicking "Download"

Hello!

Customers can't download invoices. When they click on the "Download" button, they are redirected to the main WHMCS login page instead of downloading PDF.

Why?