wKoza / ngx-upload

Ngx-upload is an upload module for Angular Ivy ready
30 stars 15 forks source link

Token Authorization #68

Closed evilkent911 closed 5 years ago

evilkent911 commented 5 years ago

Hi @wKoza , may i know how to include token authorization in the upload service ?

wKoza commented 5 years ago

Hi @evilkent911,

If you're talking about bearer token witch have to be in your headers, you can add your header like this

uploader.uploadAll({method: 'POST', url: 'my_url'}, **{headers: ...}**).

The same concept has been used for building FileItem :

upload(endpoint: UploadEndPoint, options?: any)

Options is the Angular's object:

options: { headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType: "arraybuffer"; withCredentials?: boolean; }
evilkent911 commented 5 years ago

hi @wKoza , it work. thank you