0
내 문제는 내가 제대로 요청을 구축 한 생각이지만, 내가 [400 { "메시지": "문제 JSON을 구문 분석"}] 얻고 여기 GitHub의 기본 인증
내 코드입니다 :var xhr = Ti.Network.createHTTPClient({
onload : function() {
Ti.API.debug(this.responseText);
json = JSON.parse(this.responseText);
callback(json);
},
onerror : function(e) {
alert('error!');
Ti.API.info(e.error + " " + this.status + " " + this.responseText);
}
});
xhr.validatesSecureCertificate = true;
xhr.open("POST", "https://api.github.com/authorizations");
xhr.setTimeout(10000);
authstr = 'Basic ' + Titanium.Utils.base64encode(User.username + ':' + User.password);
xhr.setRequestHeader('Authorization', authstr);
xhr.send({username: User.username, password: User.password});