Open source video conferencing app powered by LiveKit. Built with Django and React.
✨(backend) expose is_authenticated in the LiveKit token
lebaudantoineec9cd84cf88e
diff --git a/src/backend/core/tests/rooms/test_api_rooms_retrieve.py b/src/backend/core/tests/rooms/test_api_rooms_retrieve.pyindex d27b13bf..e5c3fc46 100644--- a/src/backend/core/tests/rooms/test_api_rooms_retrieve.py+++ b/src/backend/core/tests/rooms/test_api_rooms_retrieve.py@@ -12,7 +12,7 @@ import pytestfrom rest_framework.test import APIClientfrom ...factories import RoomFactory, UserFactory, UserResourceAccessFactory-from ...models import RoomAccessLevel, RoleChoices+from ...models import RoleChoices, RoomAccessLevelpytestmark = pytest.mark.django_dbdiff --git a/src/backend/core/utils.py b/src/backend/core/utils.pyindex a73e86f5..b35b5bcb 100644--- a/src/backend/core/utils.py+++ b/src/backend/core/utils.py@@ -128,7 +128,11 @@ def generate_token(.with_identity(identity).with_name(display_name).with_attributes(- {"color": color, "room_role": role }+ {+ "color": color,+ "room_role": role,+ "is_authenticated": "true" if user.is_authenticated else "false",+ }))diff --git a/src/frontend/src/features/rooms/utils/getParticipantIsAuthenticated.ts b/src/frontend/src/features/rooms/utils/getParticipantIsAuthenticated.tsnew file mode 100644index 00000000..9b55dcde--- /dev/null+++ b/src/frontend/src/features/rooms/utils/getParticipantIsAuthenticated.ts@@ -0,0 +1,8 @@+import type { Participant } from 'livekit-client'++export const getParticipantIsAuthenticated = (+ participant: Participant+): boolean => {+ const isAuthenticated = participant.attributes?.is_authenticated+ return isAuthenticated == 'true'+}