This is a migrated thread and some comments may be shown as answers.

Adding Authorization Header to subsequent calls

1 Answer 185 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Yusef
Top achievements
Rank 1
Yusef asked on 15 Apr 2016, 07:11 AM

I have an Angular App that muss send an authorization header within every request that makes to the server.

When defining the kendo datasource, I've added the header field:

this._tableData = new kendo.data.DataSource({
      transport: {
        read: {
          cache: true,
          url: `${this.baseUrl}/uiobjects/_search`,
          dataType: "json",
          contentType: "application/json; charset=utf-8",
          type: "POST",
          headers: {'Authorization': this.header}
        },

Allowing me to fill the kendo grid with data, but for one of the rows I've defined a template:

template: `<div class='title'><div class='pic'><img src="#:_links.previewdata.href#" alt="thumbnail"></div><span>#: title #</span></div>`

and there makes another request to the server in order to grab the image. 

My problem here, is that I am not being able to set this authorization header for these request. Angular interceptors doesn't work because they are not made through $http.

Is there any clean way to intercep these request, or to add a Header??

1 Answer, 1 is accepted

Sort by
0
Petyo
Telerik team
answered on 19 Apr 2016, 07:07 AM
Hi,

I may suggest that you use the following approach to pass the datasource request through the $http service.

Regards,
Petyo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
General Discussions
Asked by
Yusef
Top achievements
Rank 1
Answers by
Petyo
Telerik team
Share this question
or