From 42bf56a4c2396c8ff8fd312443f03fc4b35d13a1 Mon Sep 17 00:00:00 2001 From: Michael Smit Date: Thu, 2 Jan 2025 17:13:38 -0800 Subject: [PATCH] Use Authorization header instead of Authentication partially addresses #2263 updated useAuthenticatedFetch to correctly set the "Authorization" header to the bearer token instead of "Authentication" --- src/__tests__/hooks/useAuthenticatedFetch.test.js | 2 +- src/hooks/useAuthenticatedFetch.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/__tests__/hooks/useAuthenticatedFetch.test.js b/src/__tests__/hooks/useAuthenticatedFetch.test.js index 6199fd39d..24c558f25 100644 --- a/src/__tests__/hooks/useAuthenticatedFetch.test.js +++ b/src/__tests__/hooks/useAuthenticatedFetch.test.js @@ -55,7 +55,7 @@ describe("useAuthenticatedFetch", () => { ...requestOptions, headers: { ...requestOptions.headers, - Authentication: "Bearer TEST_AUTH_TOKEN", + Authorization: "Bearer TEST_AUTH_TOKEN", }, }, ]); diff --git a/src/hooks/useAuthenticatedFetch.js b/src/hooks/useAuthenticatedFetch.js index eecfba2b6..ae8db5573 100644 --- a/src/hooks/useAuthenticatedFetch.js +++ b/src/hooks/useAuthenticatedFetch.js @@ -18,7 +18,7 @@ export function useAuthenticatedFetch() { try { //as per https://auth0.com/docs/quickstart/spa/react/02-calling-an-api const accessToken = await getAccessTokenSilently(); - headers["Authentication"] = `Bearer ${accessToken}`; + headers["Authorization"] = `Bearer ${accessToken}`; } catch (error) { //IGNORE. If we can't get an access token we just call the API //without it.