@@ -303,25 +303,29 @@ const resolveSignedInAuthStateFromJWTClaims = (claims: JwtPayload): SignedInAuth
303
303
let orgId : string | undefined ;
304
304
let orgRole : OrganizationCustomRoleKey | undefined ;
305
305
let orgSlug : string | undefined ;
306
+ let orgPermissions : string [ ] | undefined ;
306
307
307
308
// fva can be undefined for instances that have not opt-in
308
309
const factorVerificationAge = claims . fva ?? null ;
309
310
310
311
// sts can be undefined for instances that have not opt-in
311
312
const sessionStatus = claims . sts ?? null ;
312
313
313
- // TODO(jwt-v2): replace this when the new claim for org permissions is added, this will not break
314
- // anything since the JWT v2 is not yet available
315
- const orgPermissions = claims . v === 2 ? undefined : claims . org_permissions ;
316
-
317
- if ( claims . v === 2 ) {
318
- orgId = claims . org ?. id ;
319
- orgRole = claims . org ?. rol ;
320
- orgSlug = claims . org ?. slg ;
321
- } else {
322
- orgId = claims . org_id ;
323
- orgRole = claims . org_role ;
324
- orgSlug = claims . org_slug ;
314
+ switch ( claims . v ) {
315
+ case 2 :
316
+ orgId = claims . org ?. id ;
317
+ orgRole = claims . org ?. rol ;
318
+ orgSlug = claims . org ?. slg ;
319
+
320
+ // TODO(jwt-v2): when JWT version 2 is available, do proper handling for org permissions
321
+ orgPermissions = ( claims ?. org_permissions as string [ ] | undefined ) ?? undefined ;
322
+ break ;
323
+ default :
324
+ orgId = claims . org_id ;
325
+ orgRole = claims . org_role ;
326
+ orgSlug = claims . org_slug ;
327
+ orgPermissions = claims . org_permissions ;
328
+ break ;
325
329
}
326
330
327
331
return {
0 commit comments