0

I am trying to connect a JavaScript client with a TFS 2015 API to get some information and save it in my SQL Database, but I am having challenges establishing this connection with JavaScript. They are using Windows authorization.

I used this code but it didn't work:

$.ajax({ 
    url: 'https://tfs........',
    type: 'GET',
    dataType: 'json',
    xhrFields: {
        withCredentials: true
    }
})
.done(function (data) {
    console.log(data);
})
.fail(function (jqXHR, textStatus, errorThrown) {
     console.log(textStatus);
});

Can anyone help me please?

Mark
  • 1,312
  • 1
  • 16
  • 33
A.schmidt
  • 1
  • 2
  • If you are seeing a specific error, please add it to the question. – Mark Apr 16 '17 at 21:02
  • the errors: - SEC7121: wildcard in Access-Control-Allow-Origin not allowed when Credentials flag is set to true - SCRIPT7002: XMLHttpRequest Network Error 0x80070005.access denied – A.schmidt Apr 16 '17 at 22:02

1 Answers1

0

Refer to these 2 threads(one, two), check if the Access-Control-Allow-Origin is a wildcard like '*'. This is not allowed.

Update:

Refer to this case who have similar issue with you: connecting to TFS using windows auth in electron app.

You could create a login in page, and store username and password in cookies. Then use httpntlm to do this request.

Community
  • 1
  • 1
Tingting0929
  • 4,142
  • 1
  • 14
  • 14
  • Tingting0929-MSFT i used jquery library can i use this Code directly? – A.schmidt Apr 17 '17 at 11:10
  • Unfortunately not i dont know where is the problem maybe its the authentication. or maybe i didnt know hoe to use the code correctly :( – A.schmidt Apr 19 '17 at 14:40
  • the Problem in the company, they dont use basic authentication but they use windows authentication also the username and password they are the same to log on in the windows system of the company – A.schmidt Apr 20 '17 at 07:34
  • @A.schmidt Sorry for that I misunderstood your issue. I through you want to create a extension of TFS. I have edited my reply and delete the wrong comments. – Tingting0929 Apr 20 '17 at 08:09
  • Unfortunatly not. it dosent work it cannot connect. i think because of the windows-authentication – A.schmidt Apr 27 '17 at 09:57
  • can i create & use (personal access tokens) when the Basic Authentication is not enabled?? – A.schmidt Apr 27 '17 at 21:46
  • Yes, it doesn't need Basic Authentication. – Tingting0929 Apr 28 '17 at 01:42
  • it seems like there is no (Personal access Tocken) in TFS2015:( but i heared that i can run my Javascript-Client with Active Directory user and use AD integration to connect with TFS2015 what do you think ?? – A.schmidt Apr 30 '17 at 18:22
  • sorry if i disturb u it seems like there is no (Personal access Tocken) in TFS2015:( but i heared that i can run my Javascript-Client with Active Directory user and use AD integration to connect with TFS2015 what do you think ?? – A.schmidt May 10 '17 at 08:09