Download a file requiring an authentication token

I am using an AngularJS application with a REST backend (using Spring Boot).

Currently, I can upload the file as follows:

<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 now it no longer works. AJAX call authentication works by adding x-auth-tokenan HTTP header for each request.

But simple hrefdoes not have x-auth-tokena title. I tried using $http.get()on ng-click, but which may not work .

Is there a simple alternative?

+4
source share
1 answer

angular. blob . : , , 5 . . , , , , . .

.

+1

Source: https://habr.com/ru/post/1538892/


All Articles