Skip to content

Commit

Permalink
Work around to get around #1
Browse files Browse the repository at this point in the history
  • Loading branch information
borisno2 committed Mar 11, 2021
1 parent 5876a87 commit 9de1a8d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions api/azure-functions-auth0.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ const getJwtValidationError = (err, location, secret) => {

const validateJwt = expressValidateJwt => (next, returnPromise) => {
return (context, req, ...rest) => {
// Switching from the correct spelling back to American to get around Azure Web apps using that header...
if (req.headers.authorisation){
req.headers.authorization = req.headers.authorisation
}
if (returnPromise) {
return new Promise(resolve => {
expressValidateJwt(req, null, handleResult(resolve));
Expand Down
3 changes: 2 additions & 1 deletion src/views/ExternalApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ export const ExternalApiComponent = () => {
const token = await getAccessTokenSilently();

const response = await fetch(`${apiOrigin}/GetMessage`, {
// Using correct spelling of Authorisation to trick Azure Static Webapps into letting us authenticate
headers: {
Authorization: `Bearer ${token}`,
Authorisation: `Bearer ${token}`,
},
});

Expand Down

0 comments on commit 9de1a8d

Please sign in to comment.