From 8dd323578ee9e1221151abafb2ac035e4ff22824 Mon Sep 17 00:00:00 2001 From: Truc Nguyen Date: Wed, 27 Nov 2024 20:53:26 +0000 Subject: [PATCH] fix: attempt to fix data loading due auth issue (#14) --- frontend/src/common/httpservice.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/frontend/src/common/httpservice.ts b/frontend/src/common/httpservice.ts index cab9b26..8204944 100644 --- a/frontend/src/common/httpservice.ts +++ b/frontend/src/common/httpservice.ts @@ -17,12 +17,17 @@ const client = axios.create({ async function getAuthHeaders() { try { - const token = await auth0.getTokenSilently(); + const token = await auth0.getTokenSilently({ + authorizationParams: { + scope: "read:current_user", + audience: import.meta.env.VITE_AUTH0_AUDIENCE + } + }); return { Authorization: `Bearer ${token}` }; } catch (e) { - alert('Unable to get access token!!!'); + alert(`Unable to get access token: ${e}`); return {}; } }