From efcb995db93fc08d6e0e731ce9ca76e9747723a7 Mon Sep 17 00:00:00 2001 From: Maxim Zaytsev Date: Fri, 20 Sep 2024 10:02:21 +0200 Subject: [PATCH] Updated PAT length (#608) --- api/WebApi.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/WebApi.ts b/api/WebApi.ts index 6bcee02..ea9563c 100644 --- a/api/WebApi.ts +++ b/api/WebApi.ts @@ -49,6 +49,7 @@ import url = require('url'); import path = require('path'); const isBrowser: boolean = typeof window !== 'undefined'; +const personalAccessTokenRegex : RegExp = new RegExp('^.{76}AZDO.{4}$'); /** * Methods to return handler objects (see handlers folder) */ @@ -70,7 +71,7 @@ export function getPersonalAccessTokenHandler(token: string, allowCrossOriginAut } export function getHandlerFromToken(token: string, allowCrossOriginAuthentication?: boolean): VsoBaseInterfaces.IRequestHandler { - if (token.length === 52) { + if (token.length === 52 || personalAccessTokenRegex.test(token)) { return getPersonalAccessTokenHandler(token, allowCrossOriginAuthentication); } else {