From 41c16820e51d1e5d7580bec485a5f0fdefd70d19 Mon Sep 17 00:00:00 2001 From: help4bis Date: Fri, 3 Apr 2026 06:32:55 +1000 Subject: [PATCH] =?UTF-8?q?fix:=20calls=20=E2=80=94=20JWT=20field=20name?= =?UTF-8?q?=20'jwt'=20not=20'token',=20CORS=20dedup=20on=20server?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - lk-jwt-service returns {jwt: '...', url: '...'} not {token: '...'} Now reads both 'jwt' and 'token' fields for compatibility - Server nginx: added proxy_hide_header to strip upstream CORS headers preventing duplicate Access-Control-Allow-Origin (browser rejects) Co-Authored-By: Claude Opus 4.6 (1M context) --- lib/features/calls/data/livekit_service.dart | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/features/calls/data/livekit_service.dart b/lib/features/calls/data/livekit_service.dart index 2efdf8b..f4135f7 100644 --- a/lib/features/calls/data/livekit_service.dart +++ b/lib/features/calls/data/livekit_service.dart @@ -154,12 +154,13 @@ class LiveKitService { } final json = jsonDecode(response.body) as Map; - final token = json['token'] as String?; + // lk-jwt-service returns 'jwt' (not 'token') per Element spec + final token = (json['jwt'] ?? json['token']) as String?; final url = json['url'] as String?; if (token == null || url == null) { - debugPrint('[LiveKit] Response fields: ${json.keys.toList()}'); - return _JwtError('JWT response missing token or url fields.'); + debugPrint('[LiveKit] Response keys: ${json.keys.toList()}'); + return _JwtError('JWT response missing jwt or url. Got: ${json.keys}'); } debugPrint('[LiveKit] JWT obtained, LiveKit URL: $url');