使用Javascript连接具有(kerberos身份验证)的TFS-2015 [英] Connecting TFS-2015 which has (kerberos Authentication) using Javascript

查看:70
本文介绍了使用Javascript连接具有(kerberos身份验证)的TFS-2015的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试连接TFS-2015(kerberos身份验证)

我在JS-Code下使用,但它没有用:(

$。ajax({


url:

"
https://< server> /< collection> /_apis/wit/workitems/api-version=3.0 ",
type:'GET',

crossDomain:true,

dataType:'json',

xhrFields:{

withCredentials:true

}
})。done(function(data){console.log('done');

console.log(data);

})。失败(函数(jqXHR,textStatus,errorThrown){
$
console.log('error'); console.log(errorThrown);

});

I try to connect TFS-2015 (kerberos Authentication)
I am using below JS-Code , but it didnt work :(

$.ajax({
url:
"
https://<server>/<collection>/_apis/wit/workitems/api-version=3.0",
type: 'GET',
crossDomain: true,
dataType: 'json',
xhrFields: {
withCredentials: true
}
}).done(function(data){ console.log('done');
console.log(data);
}).fail(function(jqXHR,textStatus ,errorThrown){
console.log('error'); console.log(errorThrown);
});

推荐答案

嗨Yahya.asf,

Hi Yahya.asf,

您在控制台中出现的错误是什么?

What's the error you got in the console?

您是否考虑使用基本身份验证来访问REST API?

Would you consider using basic auth to access to REST API?


(document).ready(function(){
var username ='{username}';
var password ='{Password}';
(document).ready(function () { var username = '{username}'; var password = '{Password}';


.ajax({
beforeSend:function(xhr){
xhr.setRequestHeader(" Authorization" ;,"基本"+ btoa(用户名+":" +密码));
},
类型:'GET',
url:'http:// { server:8080 / tfs / DefaultCollection2015 / _apis / wit / workitems / {id}?api-version = 1.0',
contentType:'application / json',
success:function(data){
alert(数据);
alert('成功获得服务器');
},//成功函数
错误:function(msg,url,line){

alert(msg.responseText);
alert(url);
alert(line);
}
});
});
.ajax({ beforeSend: function (xhr) { xhr.setRequestHeader("Authorization", "Basic " + btoa(username + ":" + password)); }, type: 'GET', url: 'http://{server}:8080/tfs/DefaultCollection2015/_apis/wit/workitems/{id}?api-version=1.0', contentType: 'application/json', success: function (data) { alert(data); alert('GET SUCCESSFULLY TO THE SERVER'); }, // Success Function error: function (msg, url, line) { alert(msg.responseText); alert(url); alert(line); } }); });

最好的问候


这篇关于使用Javascript连接具有(kerberos身份验证)的TFS-2015的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆