Skip to content

Commit d24ca88

Browse files
authored
Merge pull request #115 from abdelrahman-zaki/fix/get-user-organizations-null-guard
fix: guard getUserOrganizations when org_codes claim is missing
2 parents 921073c + 1fbfe0e commit d24ca88

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/sdk/utilities/token-claims.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,10 @@ export const getUserOrganizations = async (
150150
sessionManager: SessionManager,
151151
validationDetails: TokenValidationDetailsType
152152
): Promise<{ orgCodes: string[] }> => ({
153-
orgCodes: (await getClaimValue(
153+
orgCodes: ((await getClaimValue(
154154
sessionManager,
155155
'org_codes',
156156
'id_token',
157157
validationDetails
158-
)) as string[],
158+
)) ?? []) as string[],
159159
});

0 commit comments

Comments
 (0)