在电子应用程序中使用 Windows auth 连接到 TFS [英] connecting to TFS using windows auth in electron app

查看:20
本文介绍了在电子应用程序中使用 Windows auth 连接到 TFS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个连接到 TFS 服务器并从中检索一些数据的电子应用程序.他们使用 Windows 凭据访问 TFS,我如何通过 chrome 或 node.js 使用 Windows 凭据连接到 TFS?

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 ?

我尝试了这段代码,但给了我 401:未授权

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. 将用户名和密码存储在变量、cookie 或 本地存储
  3. 使用 httpntml 和用户名、密码、域发送请求
  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

这篇关于在电子应用程序中使用 Windows auth 连接到 TFS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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