Skip to content

fix: decode JWT video grants from the camelCase claim keys - #1237

Merged
hiroshihorie merged 1 commit into
livekit:mainfrom
RaphaelFakhri:fix/jwt-video-grant-claim-names
Oct 15, 2026
Merged

hiroshihorie merged 1 commit into
livekit:mainfrom
RaphaelFakhri:fix/jwt-video-grant-claim-names

Conversation

@RaphaelFakhri

Copy link
Copy Markdown
Contributor

Summary

Fixes #1236.

LiveKitVideoGrant mapped its fields to snake_case keys such as room_join, can_publish and can_publish_sources. LiveKit tokens write the video claim with camelCase keys (roomJoin, canPublish, canPublishSources), as defined in livekit/protocol auth/grants.go and used by the server SDKs and the Android SDK. As a result, TokenSourceResponse.jwtPayload?.video returned null for every grant except room, hidden and recorder when it decoded a real token.

This change:

  • Removes the snake_case @JsonKey renames from LiveKitVideoGrant, so json_serializable uses the field names, which match the claim keys.
  • Regenerates jwt.g.dart.

Test plan

  • test/token/token_source_test.dart: the parses claims and grants from token test and the _generateToken helper now build the video claim with the keys that LiveKit tokens use, and the test also checks canSubscribe.
  • Before the change the test fails with Expected: true, Actual: <null> on grant.roomJoin. After the change it passes.
  • flutter test test/token/, flutter analyze, dart format --set-exit-if-changed and import_sorter pass.
  • Added a .changes entry.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@hiroshihorie
hiroshihorie merged commit f9568e8 into livekit:main Oct 15, 2026
15 checks passed
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.

jwtPayload.video returns null grants for tokens from LiveKit server SDKs

2 participants