I am new to node.js 'azure-devops-node-api'. I want to connect with my collection, getPersonalAccessTokenHandler(token) method works fine, But I want to authenticate with username and password. getNtlmHandler(username, password) do authenticates but I am unable to get respositories with this approach. Kindly suggest me a better method to authenticate please
const azdev = require("azure-devops-node-api");
const collectionURL = 'https://dev.azure.com/username';
let authHandler = azdev.getNtlmHandler('username', 'password');
let connection = new azdev.WebApi(collectionURL, authHandler);
connection.connect().then(connData => {
console.log(`Connection established successfully!!!. This is
${connData.authenticatedUser.providerDisplayName}. Welcome!!!`);
connection.getGitApi().then(vstsGit => {
vstsGit.getRepositories('projectName').then(repos => {
// repos is null or undefined
console.log('There are', repos.length, 'repositories in this
project');
// But When I authenticates with Token, It works fine.
});
});
});