connecting to TFS using windows auth in electron a

2019-03-05 08:03发布

i'm building an electron app that connect to a TFS server and retrieve some data from it. They use Windows credential to access TFS , how can i connect to TFS using Windows credential through chrome or node.js ?

i tried this code but give me 401 : unauthorized

$.ajax({
                url: 'https://tfs.myserver.com:8090/tfs/IKM.TPC.Projects/MR/_workitems',
                type: 'GET',
                dataType: 'json',
                xhrFields: {
                    withCredentials: true
                }
                })
                .done(function (data) {
                    $('#result').text(data);
                })
                .fail(function (jqXHR, textStatus, errorThrown) {
                    $('#result').text(textStatus);
                });

1条回答
仙女界的扛把子
2楼-- · 2019-03-05 08:20

Simple steps:

  1. Create a login page to let user login with username and password
  2. Store username and password in a variable, cookie or local storage
  3. Send the request by using httpntml with username, password, domain
查看更多
登录 后发表回答