Skip to content

Commit

Permalink
fix: receive roles as array or object (#80)
Browse files Browse the repository at this point in the history
this is to resolve
#48

although it's better to investigate the root cause of why the roles type
is not consistent, I believe this can be an acceptable solution to
bypass the broken build until a full investigation is done.

Co-authored-by: elmawardy <[email protected]>
Co-authored-by: David Skewis <[email protected]>
  • Loading branch information
3 people authored Nov 27, 2024
1 parent c1854d3 commit 52286b1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/src/zitadelAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

}
}
}

0 comments on commit 52286b1

Please sign in to comment.