I am implementing an AngularJS app with a REST backend (using Spring Boot).
I can currently download a file like this:
<td><a href="/api/datasheets/{{datasheet.id}}/documents/{{document.id}}/download" download>Download</a></td>
Now, I am adding security (using Spring Security) to my application and this now no longer works. The authentication of the AJAX calls works by adding x-auth-token
in the HTTP header for each request.
But a simple href
does not have the x-auth-token
in the header ofcourse. I tried using $http.get()
on an ng-click
, but that cannot not work.
Is there a simple alternative?