diff --git a/src/components/defaultAuthenticator.ts b/src/components/defaultAuthenticator.ts index b539b7aa7..109814f53 100644 --- a/src/components/defaultAuthenticator.ts +++ b/src/components/defaultAuthenticator.ts @@ -111,6 +111,10 @@ export class DefaultAuthenticator implements IAuthenticator { return accessToken; } - throw new Error(`Access token format is not valid. Please use "Bearer" or "SharedAccessSignature".`); + accessToken = this.parseSharedAccessSignature(token); + + if (!accessToken) { + throw new Error(`Access token format is not valid. Please use "Bearer" or "SharedAccessSignature".`); + } } } \ No newline at end of file diff --git a/src/components/users/confirm-password/ko/runtime/confirm-password.ts b/src/components/users/confirm-password/ko/runtime/confirm-password.ts index f7096953a..eadd8cf63 100644 --- a/src/components/users/confirm-password/ko/runtime/confirm-password.ts +++ b/src/components/users/confirm-password/ko/runtime/confirm-password.ts @@ -67,7 +67,7 @@ export class ConfirmPassword { } try { - this.token = this.usersService.getTokenFromTiketParams(queryParams); + this.token = this.usersService.getTokenFromTicketParams(queryParams); this.userId = this.usersService.getUserIdFromParams(queryParams); if (!this.userId) { diff --git a/src/services/usersService.ts b/src/services/usersService.ts index d85456b66..fd92f07d2 100644 --- a/src/services/usersService.ts +++ b/src/services/usersService.ts @@ -56,7 +56,7 @@ export class UsersService { } } - public getTokenFromTiketParams(parameters: URLSearchParams): string { + public getTokenFromTicketParams(parameters: URLSearchParams): string { const ticket = parameters.get("ticket"); const ticketId = parameters.get("ticketid"); const token = `Ticket id="${ticketId}",ticket="${ticket}"`; @@ -82,8 +82,11 @@ export class UsersService { } public async updatePassword(userId: string, newPassword: string, token: string): Promise { - const heasers = [{ name: "Authorization", value: token }]; - await this.mapiClient.patch(userId, heasers, { password: newPassword }); + const headers = [] + if (token) { + headers.push({ name: "Authorization", value: token }); + } + await this.mapiClient.patch(userId, headers, { password: newPassword }); } /**