livekit / livekit-server-sdk-python

LiveKit Server SDK for Python
Apache License 2.0
25 stars 6 forks source link

Authentication with egress server #11

Closed sngc1 closed 1 year ago

sngc1 commented 1 year ago

Hello, thanks for the Python SDK!

Is there any example of sending a request to the Egress server? I am somehow trying to send TrackEgressRequest after joining a room below, while the server responds "status": "401", "error": "permissions denied", "code": "unauthenticated".

It is really helpful If there are any guides about how to use the EgressClient, thanks!

egress_client = livekit.twirp.EgressClient(address=MY_LIVEKIT_SERVER)

response = egress_client.StartTrackEgress(
    ctx=twirp.context.Context(),
    request=livekit.egress.TrackEgressRequest(
        room_name=MY_ROOM,
        track_id=MY_TRACK,
        websocket_url=MY_WEBSOCKET_SERVER,
    ),
    headers={"Authorization": f"Bearer {MY_TOKEN}"},
)
davidzhao commented 1 year ago

what permissions have you granted to the token?

sngc1 commented 1 year ago

Oh I overlooked the roomRecord grant is needed to use Egress... Now the auth works, thanks!