From 678c13252c7ac7d147db8288b120fc0784ac41be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=20Lis=C3=A9?= Date: Tue, 8 Oct 2024 13:55:09 -0700 Subject: [PATCH] Switch to array contains. --- handlers/authorizer/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handlers/authorizer/index.js b/handlers/authorizer/index.js index c16c0e9..0325287 100644 --- a/handlers/authorizer/index.js +++ b/handlers/authorizer/index.js @@ -31,7 +31,7 @@ exports.handler = async function (event, context, callback) { console.log("userData:", userData); // Generate the methodArn for the user to access the API - if (userData.claims === 'sysadmin') { + if (userData.claims?.includes('sysadmin')) { const arnPrefix = event.methodArn.split(':').slice(0, 6); const joinedArnPrefix = arnPrefix.slice(0, 5).join(':'); const apiIDString = arnPrefix[5];