TFS 2015 업데이트 3에서는 모든 것이 문제없이 작동했습니다. 나는 npm 패키지 request을 사용하여 모든 apis를 아무런 문제없이 소비했다. 사용 JQuery와 다음 호출은 항상 올바르게 완료 할 것 :AFS가 TFS 15를 호출합니다. 업그레이드 후 Rest API가 작동을 멈 춥니 다.
//this used to work in 2015 Update 3
var request = {
url: "https://my_server/tfs/DefaultCollection/_apis/projects?api-version=2.0",
type:'GET',
contentType: "application/json",
accepts: "application/json",
dataType: 'json',
data: JSON.stringify(data),
beforeSend: function (xhr) {
xhr.setRequestHeader("Authorization", "Basic " + btoa("my_username:my_password"));
}
};
$.ajax(request);
을 위의 메커니즘이 더 이상 작동하지 않습니다 TFS 15 RC2로 업그레이드 한 후. 서버는 항상 401 - Unauthorized 오류를 반환합니다.
//this will fail
curl https://my_server/tfs/DefaultCollection/_apis/projects?api-version=2.0 \
-H "Accept: application/json" \
-H "Authorization: Basic eNjPllEmF1emEuYmFuNppOUlOnVuZGVmaW5lZA=="
같은 401 : 나는 헤더에 자격 증명을 보내려고 할 때,이 같은 실패를 다시
//this works well
curl -u my_username:my_password https://my_server/tfs/DefaultCollectiopis/projects?api-version=2.0
그러나 : 컬를 통해 같은 전화를 테스트
는, 모든 것이 잘 작동 - 허가되지 않은 오류.
$(document).ready(function() {
$.ajax({
url: 'https://my_server/defaultcollection/_apis/projects?api-version=2.0',
dataType: 'json',
headers: {
'Authorization': 'Basic ' + btoa("" + ":" + myPatToken)
}
}).done(function(results) {
console.log(results.value[0].id + " " + results.value[0].name);
});
});
here를 표시하고 또한 실패로
나는 테스트를이 TFS 15 RC2에 포함되어 있기 때문에, 내 개인 액세스 토큰을 설정하고 수행했습니다. 하지만, 내 실제 암호를 myPatToken를 교체뿐만 아니라 사용자 이름을 통과 한 후, 그 요청이 성공적으로 완료 다음 간단히 말해서//everything works correctly with the headers like this
headers: {
'Authorization': 'Basic ' + btoa("my_username:my_password")
}
가, 뭔가 잘못 가고 내가 설정이 (사용 JQuery와) 같은 헤더 :
그리고 내가 사용하고있는 패키지 npm request처럼 보이며 beforeSend 속성이나 그와 비슷한 것을 사용하고 있습니다.
//this used to work with 2015 Update 3, not anymore after upgrading to 15 RC2
var options = {
url: 'https://my_server/defaultcollection/_apis/projects?api-version=2.0',
method:'GET',
headers: {
'Authorization': "Basic " + btoa("my_username:my_password")
},
json: data
};
request(options, (error, response, body) => {
if (!error && response.statusCode == 200) {
console.log(response);
} else {
console.log(error);
}
});
IIS 구성에는 문제가 있지만 기본 인증이 올바르게 구성되었다고 생각됩니다. 패키지 요청을 사용하여이 작업을 수행하는 방법이 있습니까? 업그레이드 후 IIS 구성에서 변경된 사항이 있습니까?