Skip to content

Commit

Permalink
Use Authentication not Authorzation in header
Browse files Browse the repository at this point in the history
partially addresses #2263

updated useAuthenticatedFetch to correctly set the "Authentication" header instead
of "Authorization"
  • Loading branch information
Michael Smit committed Jan 3, 2025
1 parent 888ae83 commit e803e25
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/__tests__/hooks/useAuthenticatedFetch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe("useAuthenticatedFetch", () => {
...requestOptions,
headers: {
...requestOptions.headers,
Authentication: "Bearer TEST_AUTH_TOKEN",
Authorization: "Bearer TEST_AUTH_TOKEN",
},
},
]);
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useAuthenticatedFetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit e803e25

Please sign in to comment.