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

DataSource and Authentication

1 Answer 313 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Kakone
Top achievements
Rank 1
Kakone asked on 27 Mar 2012, 10:18 AM
Hello,

I have an OData service with custom basic authentication. With your dataSource, how can I set the username and the password ? Can I access the request headers ?

Cordially,
Kakone.

1 Answer, 1 is accepted

Sort by
0
Tom
Top achievements
Rank 1
answered on 01 May 2012, 02:46 AM
Hello, 

Did you ever find a solution to your answer? I tried header authentication: 
transport: {
   read: {
      url: "https://example.com/mydata/", // the remove service url
      dataType: "jsonp",
        beforeSend: function(req) {
         req.setRequestHeader('Authorization', 'Basic asdfjaosihn*&==);
    }
   }
},

But I'm reading that its not possible like this (ref: http://stackoverflow.com/questions/3073336/is-it-possible-to-make-cross-domain-requests-in-javascript-and-set-custom-header). 

Were you able to find a solution?

Thanks, 

Tom
Tags
Data Source
Asked by
Kakone
Top achievements
Rank 1
Answers by
Tom
Top achievements
Rank 1
Share this question
or