From 2ed0418bd9540688075abacb4d7ab96d5bf5fae0 Mon Sep 17 00:00:00 2001 From: Aaron van Meerten Date: Fri, 17 May 2024 11:29:11 -0500 Subject: [PATCH] fix(jwt): Fixes parsing JWT in hash as JSON instead of a string (#14760) --- react/features/base/jwt/functions.ts | 2 +- react/features/base/util/uri.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/react/features/base/jwt/functions.ts b/react/features/base/jwt/functions.ts index 02c7d62228..5583b31cda 100644 --- a/react/features/base/jwt/functions.ts +++ b/react/features/base/jwt/functions.ts @@ -19,7 +19,7 @@ import logger from './logger'; */ export function parseJWTFromURLParams(url: URL | typeof window.location = window.location) { // @ts-ignore - const jwt = parseURLParams(url, true, 'hash').jwt; + const jwt = parseURLParams(url, false, 'hash').jwt; // TODO: eventually remove the search param and only pull from the hash // @ts-ignore diff --git a/react/features/base/util/uri.ts b/react/features/base/util/uri.ts index 9c89c991e5..34f86b12a8 100644 --- a/react/features/base/util/uri.ts +++ b/react/features/base/util/uri.ts @@ -564,9 +564,9 @@ export function urlObjectToString(o: { [key: string]: any; }): string | undefine if (jwt) { if (hash.length) { - hash = `${hash}&jwt=${jwt}`; + hash = `${hash}&jwt=${JSON.stringify(jwt)}`; } else { - hash = `#jwt=${jwt}`; + hash = `#jwt=${JSON.stringify(jwt)}`; } }