`jwtPayload.roomConfiguration` returns null fields for tokens from LiveKit server SDKs
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Domain
- backend-api-design
Research direction
Read lib/src/token_source/room_configuration.dart and the existing test for token room configuration parsing, which currently uses snake_case keys. Check how the parser handles protobuf JSON camelCase fields such as emptyTimeout and agentName; the issue’s reproduction gives a minimal token to use. Done means the parsed values are 300 and assistant for that token, with the existing tests updated or extended to cover the format.
Written by the indexing model from the issue text.
Description
Describe the bug
TokenSourceResponse.jwtPayload?.roomConfiguration returns a RoomConfiguration whose numeric and boolean fields are null, and whose agents have a null agentName, even when the token sets them. For example, roomConfiguration.agents.first.agentName and roomConfiguration.emptyTimeout are null for a token whose room configuration dispatches an agent and sets an empty timeout. dispatchesAgent() still works because it only checks that the agents list is not empty.
Root cause
RoomConfiguration and RoomAgentDispatch in lib/src/token_source/room_configuration.dart read snake_case keys (agent_name, empty_timeout, max_participants, and so on). Those keys match the token endpoint request format, which uses the same classes. LiveKit tokens write the roomConfig claim as protobuf JSON, which uses camelCase keys:
livekit/protocolauth/grants.go:RoomConfiguration.MarshalJSONcallsprotojson.Marshal.livekit-api(Python):claims["roomConfig"] = MessageToDict(self.room_config).livekit-server-sdk(Node): theRoomConfigurationprotobuf message is serialized with its JSON names.
The existing test builds its token with agent_name, so it passes. This is the same class of bug as #1236, for the roomConfig claim instead of the video claim.
To reproduce
final token = JWT({
'sub': 'alice',
'roomConfig': {
'emptyTimeout': 300,
'agents': [
{'agentName': 'assistant'},
],
},
}).sign(SecretKey('secret'));
final response = TokenSourceResponse(serverUrl: 'wss://example.livekit.cloud', participantToken: token);
final config = response.jwtPayload?.roomConfiguration;
print(config?.emptyTimeout); // null
print(config?.agents?.first.agentName); // null
Expected: 300 and assistant.
Actual: null and null.
Environment
- livekit_client main (2.13.1)
- Dominant language
- Dart
- Stars
- 421
- Forks
- 260
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 11
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from livekit/client-sdk-flutter
-
Difficulty 4/5 3-5 days Newbie friendliness 57/100
livekit/client-sdk-flutter#1245 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
livekit/client-sdk-flutter#1227 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
livekit/client-sdk-flutter#1221 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
livekit/client-sdk-flutter#1219 · 1 reaction ·
Maintainers usually reply within 1 day
-
iOS: ADM unavailable when a second Flutter engine replaces flutter_webrtc's sharedSingletonPossibly taken @hiroshihorie claimed this 34 days ago. Open
livekit/client-sdk-flutter#1206 · 2 comments · 1 assignee ·
Maintainers usually reply within 1 day
All issues in livekit/client-sdk-flutter
Similar issues
-
good-first-issue P3
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
flutter/dart-intellij-third-party#758 ·
Maintainers usually reply within 1 day
-
Bug: Incorrect location coordinates on logged Sound Meter dataPossibly taken @Jashan32 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
area/archive bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
DarkFlippers/qUnleashed#374 ·
Maintainers usually reply within 1 day
-
agent:in-progress agent:ready feature P2 · 中 区域: 悬浮窗
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
ASDW51/DanmuFloat#178 ·
Maintainers usually reply within 1 day
-
Missing workoutsOpenenhancement
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
InlitX/GymMane#237 · 1 comment ·
Maintainers usually reply within 5 days