Skip to content

Commit

Permalink
CMDCT-4292 - fixes authorization jwtDecode (#15047)
Browse files Browse the repository at this point in the history
  • Loading branch information
peoplespete authored Feb 4, 2025
1 parent bcf0d5d commit 195e07b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions services/app-api/libs/authorization.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SSMClient, GetParameterCommand } from "@aws-sdk/client-ssm";
import jwt_decode from "jwt-decode";
import { jwtDecode } from "jwt-decode";
import { CognitoJwtVerifier } from "aws-jwt-verify";
import * as logger from "./debug-lib.js";
import { SimpleJwksCache } from "aws-jwt-verify/jwk";
Expand All @@ -9,10 +9,10 @@ export async function getUserDetailsFromEvent(event) {
await verifyEventSignature(event);
const apiKey = event?.headers?.["x-api-key"];

// TODO, it seems that jwt_decode and verifier.verify may return the same object?
// Maybe we can remove the jwt_decode dependency.
// TODO, it seems that jwtDecode and verifier.verify may return the same object?
// Maybe we can remove the jwtDecode dependency.

const token = jwt_decode(apiKey);
const token = jwtDecode(apiKey);
const role = mapMembershipToRole(token["custom:ismemberof"]);

return {
Expand Down

0 comments on commit 195e07b

Please sign in to comment.