Skip to content

feat: decode the remaining JWT video grant fields - #1239

Closed
hiroshihorie wants to merge 2 commits into
mainfrom
hiroshi/jwt-video-grant-missing-fields
Closed

hiroshihorie wants to merge 2 commits into
mainfrom
hiroshi/jwt-video-grant-missing-fields

Conversation

@hiroshihorie

Copy link
Copy Markdown
Member

Note

Stacked on #1237. That PR comes from a fork, so this one targets main and also contains its commit (0e2d351). Only the last commit (90fcab53) is new here. Once #1237 merges, I'll merge main into this branch so the diff shows only this change.

Summary

LiveKitVideoGrant decoded only part of the video claim. This adds the remaining fields of VideoGrant in livekit/protocol auth/grants.go, so TokenSourceResponse.jwtPayload?.video exposes every grant a token can carry:

  • canUpdateOwnMetadata
  • ingressAdmin
  • agent
  • canSubscribeMetrics
  • canManageAgentSession
  • destinationRoom

The fields follow the protocol order and use its camelCase claim keys, which #1237 switched the class to.

Test plan

  • test/token/token_source_test.dart: the parses claims and grants from token test now sets every grant field in the token and checks each one.
  • flutter test test/token/, flutter analyze, dart format --set-exit-if-changed and import_sorter pass.
  • jwt.g.dart regenerated with build_runner. The only change is the new keys.

RaphaelFakhri and others added 2 commits October 10, 2026 19:31
Add canUpdateOwnMetadata, ingressAdmin, agent, canSubscribeMetrics,
canManageAgentSession and destinationRoom to LiveKitVideoGrant so it
covers every field of VideoGrant in livekit/protocol auth/grants.go.
@hiroshihorie

Copy link
Copy Markdown
Member Author

Closing. Client SDKs shouldn't treat token grants as the source of permissions, since the token is decoded unverified and the server can change permissions after join. Most of these fields are server-side grants, and no other client SDK exposes them.

@hiroshihorie
hiroshihorie deleted the hiroshi/jwt-video-grant-missing-fields branch October 15, 2026 04:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants