diff --git a/lib/src/zitadelAuth.ts b/lib/src/zitadelAuth.ts index 7ade3cb..424eb32 100644 --- a/lib/src/zitadelAuth.ts +++ b/lib/src/zitadelAuth.ts @@ -52,7 +52,13 @@ export function createZITADELAuth( if (!roles) { return false } - return roles.find(r => r[role]) + + if (Array.isArray(roles)) { + return roles.find(r => r[role]); + } else { + return Object.keys(roles).some(key => key === role); + } + } } }