How to use the typed-rest-client/Handlers.NtlmCredentialHandler function in typed-rest-client

To help you get started, we’ve selected a few typed-rest-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / typed-rest-client / samples / handlers.ts View on Github external
export async function run() {
    cm.banner('Handler Samples');

    const username = "";
    const password = "";
    const workstation = "";
    const domain = "";
    const url = "";

    const basicHandler: hm.BasicCredentialHandler = new hm.BasicCredentialHandler(username, password);
    const patHandler: hm.PersonalAccessTokenCredentialHandler = new hm.PersonalAccessTokenCredentialHandler('scbfb44vxzku5l4xgc3qfazn3lpk4awflfryc76esaiq7aypcbhs');
    const ntlmHandler: hm.NtlmCredentialHandler = new hm.NtlmCredentialHandler(username, password, workstation, domain);

    // These handlers would then be passed to the constructors of the http or rest modules

    // const httpClient: httpm.HttpClient = new httpm.HttpClient('vsts-node-api', [ntlmHandler]);
    // const response: httpm.HttpClientResponse = await httpClient.get(url);
    // console.log("response code: " + response.message.statusCode);
}