How to use the azure-devops-node-api/WebApi.getPersonalAccessTokenHandler function in azure-devops-node-api

To help you get started, we’ve selected a few azure-devops-node-api 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 / process-migrator / src / NodeJs / NodeJsUtilities.ts View on Github external
public static async getRestClients(accountUrl: string, PAT: string): Promise {
        const authHandler = vsts.getPersonalAccessTokenHandler(PAT);
        const vstsWebApi = new vsts.WebApi(accountUrl, authHandler);
        try {
            return {
                "witApi": await vstsWebApi.getWorkItemTrackingApi(),
                "witProcessApi": await vstsWebApi.getWorkItemTrackingProcessApi(),
                "witProcessDefinitionApi": await vstsWebApi.getWorkItemTrackingProcessDefinitionApi(),
            }
        }
        catch (error) {
            throw new KnownError(`Failed to connect to account '${accountUrl}' using personal access token '' provided, check url and token.`);
        }
    }