I have a silly issue with a an angularjs application. The setup is that I have a REST API which I have built an angularjs frontend for. The REST API uses HTTP basic authentication. I now want to allow the user download a file provided from the REST interface.
I can download the file using the $resource or the $http service which is great but I just end up with the data as blob in a javascript variable. I can't forward the file so the browser pops up the file download dialog allowing the user to download it. The other solution I thought of was forwarding the browser directly to the REST api URL for the file but I don't know how to inject the basic HTTP credentials into the header so I will get an error rather than have the file downloaded.
Do anyone know how to solve this issue?
UPDATE
I solved the issue using the duplicate question link provided. FileSaver.js did the trick for me!