[AC-1177] iOS: HTTPClient Authorization header NOT being passed
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Resolved |
Resolution | Fixed |
Resolution Date | 2014-06-18T07:30:42.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | authorization, header, httpclient, ios |
Reporter | Minh Nguyen |
Assignee | Steven Scott |
Created | 2014-06-17T07:37:21.000+0000 |
Updated | 2016-03-08T07:37:33.000+0000 |
Description
When I run below code on iOS, no Authorization header being passed, but it works well on Android ( Please see response on attachments )
// Simple HTTPClient request with Authorization header
function request(data) {
var httpClient = Ti.Network.createHTTPClient({
onload: function() {
Ti.API.info( 'SUCCESS --- ' + this.status + '\n\t' + this.responseText );
},
onerror: function() {
Ti.API.info( 'ERROR --- ' + this.status + '\n\t' + this.responseText );
}
});
httpClient.open('GET', 'http://api-minh.rhcloud.com/'); // This API simply echo all Headers being passed.
// Add Basic Authentication Header
httpClient.setRequestHeader('Authorization', 'Basic ' + Titanium.Utils.base64encode(data.email + ':' + data.token));
httpClient.setRequestHeader('Content-Type', 'application/json');
// Send
httpClient.send();
}
request({ email: 'verylonglonglong.name@gmail.com', token: '6557e9dd2d747321ecc65' });
Attachments
File | Date | Size |
---|---|---|
android.png | 2014-06-17T07:37:21.000+0000 | 79218 |
ios.png | 2014-06-17T07:37:21.000+0000 | 57277 |
I found exact issue described [here](http://yaymedia.net/?p=1323) and his solution works well.
Thanks to [Steve Carpenter](http://yaymedia.net/?page_id=4)
Customer found the resolution.