Skip to content

armgit / meet

Public Imported from GitHub
0

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.py
index 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 pytest
from rest_framework.test import APIClient
from ...factories import RoomFactory, UserFactory, UserResourceAccessFactory
-from ...models import RoomAccessLevel, RoleChoices
+from ...models import RoleChoices, RoomAccessLevel
pytestmark = pytest.mark.django_db
diff --git a/src/backend/core/utils.py b/src/backend/core/utils.py
index 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.ts
new file mode 100644
index 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'
+}