Someone from Microsoft finally gave me a solution, so here it is:
In PowerShell, run the following commands:
[Reflection.Assembly]::LoadFrom("C:\Program Files\Microsoft Team Foundation Server 14.0\Tools\Microsoft.TeamFoundation.Client.dll") $configServer = new-object Microsoft.TeamFoundation.Client.TfsConfigurationServer "http://localhost:8080/tfs/" $configHive = $configServer.GetService([Microsoft.TeamFoundation.Framework.Client.ITeamFoundationRegistry]) $configHive.SetValue("/Configuration/WebSecurity/AllowedOrigins", "domain1;domain2")
Thus, you can specify multiple domains, and you can also restrict this port and / or scheme as follows:
$configHive.SetValue("/Configuration/WebSecurity/AllowedOrigins", "localhost,port=58785,scheme=http;")
Here is an old blog post about updating the TF registry using Powershell
Then you can finally send authenticated AJAX requests to the API.
[EDIT]:. In this case, if you run it on Windows, it may work, however it does not use basic authentication.
Two options:
1. It uses Generic Credentials , automatically added to the Credential Manager (Sorry, this is in French)

2. Or it can also use your Windows session credentials .
Therefore, to make it work in a non-Windows environment, you still need a few steps.
On your TFS server, run this PowerShell command to add basic authentication:
dism /online /enable-feature /featurename:IIS-BasicAuthentication
Then, in IIS Manager, click "Authentication" on your TFS node site. You should now see Basic Authentication, just enable it.

Finally, in your JavaScript code, convert the string
DOMAIN \ username: password
in Base64 and add it to the request header (assuming you are using XMLHttpRequest):
client.setRequestHeader('Authorization', 'Basic ' + myBase64AuthString);
NOTE. Be careful with the clean Base64 JavaScript converter that you can find on the Internet. The converted string may be incorrect due to encoding. Compare your line with some Base64 online converters.
Hope this helps other people.