PDA

View Full Version : CORS & Basic access authentication



aplicativa
24 Jul 2013, 1:11 PM
Hi everybody!

We're trying to call a webservice from Sencha Touch 2.2.1 which implements CORS and Basic access authentication.

We've searched on google for the solution, but cannot find any functional code.

I've been trying with the code below:



Ext.define('Ext.data.Cors', {
extend : 'Ext.data.Connection',
alternateClassName : ['Ext.Cors'],
singleton : true,
config: {
autoAbort: false,
useDefaultXhrHeader: false
}
});


Ext.Cors.request({
url: 'https://***-tst01:7080/Choferes.svc/',
headers:{
'Authorization' : 'Basic U0lPOjFVYW5ZZWIveG9RRFdNeXRKWmQ1OWsrVVcwcz0='
},
success: function(response){
console.log('success'+response.responseText);
},
failure: function(response){
console.log('fail');
}
});


Could anyone tell us what are we making wrong?

Thanks for your help!

mitchellsimoens
26 Jul 2013, 4:14 AM
Is it sending the header? Doesn't look like on the Sencha Touch side there should be an issue.