What lk-jwt-service does in a Matrix group call deployment
lk-jwt-service is the authorization service that sits between Matrix clients, the homeserver and the LiveKit SFU. A team needs it when Element Call should run group calls on infrastructure it controls. It issues the LiveKit access tokens that let a participant join a call, so the SFU admits only people whose identity the organization's homeserver has vouched for. Plan it as part of the call stack from the start, because it adds its own hostname, credentials, reverse proxy paths and webhook wiring to the design.
Each component has a distinct job, and operators most often mix them up. LiveKit carries the media and enforces the grants it receives, but it does not decide who belongs in a call. Synapse holds the user accounts and confirms who is asking. The authorization service translates that confirmed identity into a LiveKit grant. Confirm the exact token exchange, the homeserver endpoints it calls and the settings each one expects against the upstream lk-jwt-service and Element Call documentation, because the call signalling path has changed between releases and depends on Synapse experimental features covered in a sibling topic.
Decide the homeserver scope before you deploy. The service will only be useful to the homeservers you explicitly trust, so the allowed homeserver list should match the federation policy you set for Synapse, including any federation_domain_whitelist entries. Also ask your vendor or team to confirm which ports must be open between clients, the authorization service and LiveKit, who owns each credential, and how the service is upgraded alongside Synapse, whose upgrade notes warn that rollbacks can be difficult.
How a group call join request flows through the parts
A join request starts in the Matrix client, which calls the reverse proxy on the public edge. The proxy routes the request to Synapse and to the lk-jwt-service authorization path, which issues a token for the LiveKit SFU. The client then connects media to LiveKit, and LiveKit reports room events back to the authorization service through its webhook. Check each hop when a call rings but never joins, and confirm the proxy paths reach both services.
Join request path across the public edge and internal services.
Configuration choices and when each fits
This table compares the main decisions for lk-jwt-service: where it runs, which homeservers may request access, how its credentials are created and rotated, and whether delegated leave events need appservice mode. Read each row as a choice with a cost, then match it to your federation policy and security requirements. The homeserver list and the credential process carry the most long-term risk, so settle them before users start joining calls.
| Decision | Option | Trade-off | When it fits |
|---|---|---|---|
| Host placement | Same host as LiveKit | Fewer services to patch and one place for TLS and secrets, but both services share a failure domain and host resources. | Single-site deployments where one team runs both the SFU and the authorization service. |
| Host placement | Separate hosts | Isolates the credential-bearing service from the media server, but adds a network hop and another system to maintain. | When security policy requires separating services that hold keys, or when the SFU must scale on its own. |
| Homeserver full access | Only homeservers you operate | Keeps the set of accounts that can request media access under your control, but every new homeserver needs an explicit configuration change. | Single-organization deployments where all participants have accounts on your homeserver. |
| Homeserver full access | Include federated or partner homeservers | Lets users from other servers join calls on your media capacity and widens the trust boundary you must review. | Only under a documented partner agreement, after you have confirmed capacity and access logging for their users. |
| Credential creation | Generated once and stored in a secrets manager | Simple to set up, but the team must record who holds the value and where each consumer reads it. | Small deployments with a named owner and a documented list of services that use the credential. |
| Credential rotation | Scheduled rotation with a planned restart window | Keeps exposure time short, but a change touches the service and every configuration that holds the value, so calls may drop during the change. | Organizations whose security controls require periodic key rotation and documented change records. |
| Delegated leave events | Without appservice mode | Simpler to configure, but participant state can be left stale if the departure signal does not reach the homeserver. | Test environments where you accept manual cleanup of stale call participants while you confirm behavior. |
| Delegated leave events | With appservice mode | Lets the service act for users on the homeserver when it reports a departure, but requires registering an appservice and securing its token. | When call membership must clear reliably after the SFU reports a participant leaving. Confirm the requirement against upstream documentation first. |
Setting up lk-jwt-service next to LiveKit
This sequence connects the MatrixRTC authorization service to a LiveKit SFU and a Synapse homeserver so that group calls can be authorized, routed, and cleanly ended. Each step closes with a check you can run before moving on.
Confirm Synapse, LiveKit and service versions
The platform team records the Synapse, PostgreSQL, Python, LiveKit and lk-jwt-service versions in use. Synapse 1.143.0 and later require PostgreSQL 14 or newer, and 1.142.0 and later require Python 3.10 or newer, so check those floors first. Confirm LiveKit and lk-jwt-service compatibility in each project's own release notes. Check:
psql -c "SELECT version();"returns 14 or later, and the recorded versions match a compatibility note you can cite.Create LiveKit API credentials
Generate one API key and secret pair for LiveKit and store it in your secrets manager, not in a shared config file. The same pair must be given to LiveKit and to lk-jwt-service, so the service can sign tokens the SFU accepts. Confirm the key format and environment variable names in the current LiveKit and lk-jwt-service documentation. Check: LiveKit starts and logs that the key loaded, and lk-jwt-service starts without credential errors.
Set the homeserver allow list
Add only the homeservers whose users should receive full access to the service. Use the exact server names from each homeserver's
server_namesetting, and keep the list short so that each addition is a deliberate decision. Review the list whenever a federated partner is added or removed. Check: a test account on an allowed homeserver gets a token from the service, and an account on a domain outside the list is refused.Route the reverse proxy paths
The network team sends the authorization endpoints and the LiveKit WebSocket path to their backends, both behind TLS. Confirm the exact path prefixes in the lk-jwt-service and Element Call documentation for your version. Keep the rules for these paths separate from the Synapse client and federation rules so that a mistake in one does not break the other. Check: a request to the authorization path returns the service's response rather than a homeserver 404, and a WebSocket upgrade to the SFU path succeeds.
Connect the SFU webhook
Configure LiveKit to send room and participant events to the lk-jwt-service webhook endpoint, signed with the credentials from the earlier step. The webhook lets the service react when a participant leaves the SFU, including when a connection drops without a clean hangup. Confirm the webhook path and signing behavior in the current LiveKit documentation. Check: start and end a test call, then confirm in LiveKit's webhook delivery log that the service returned success responses.
Enable appservice mode for delegated leave events
Register lk-jwt-service with Synapse as an application service using a registration file that defines its tokens and the user namespaces it may act for. Synapse needs this identity so that the service can post membership leave events on behalf of a user whose call connection ended without a clean hangup. Keep the appservice tokens in your secrets manager and restart Synapse after changing the registration. Check: Synapse loads the registration without errors, and a forced disconnect in a test call produces a leave event in the room timeline.
Test a full group call join
Two test accounts from an allowed homeserver join the same group call from separate browsers or devices. Confirm both can see and hear each other, then end one participant with a clean hangup and the other by closing the browser tab or dropping the network connection. Review the Synapse logs for errors from the service during both exits. Check: both exits leave the room with a membership event, and no account is left showing as joined after the call ends.
Why delegated leave events need appservice mode
A participant who loses their connection to the SFU does not leave the call on their own. LiveKit can tell the authorization service that a participant has dropped, but call membership is recorded in Matrix room state, and that state changes only when a leave event is sent to the room. The service cannot send that event under its own identity, and it should not hold the user's access token. The leave therefore has to be sent on the user's behalf. If it is not, other clients keep showing a participant who is no longer connected, and a call can appear occupied after everyone has gone. Confirm in the lk-jwt-service documentation for your release which webhook events it handles and how it authenticates to the homeserver before writing any configuration.
Appservice mode is the Matrix mechanism for this delegation. An application service is registered with the homeserver through a registration file, and it can then act as the users in the namespace that file declares, identifying the target user with a user_id parameter on requests made with its own token. Enabling it in Synapse means writing that registration file, generating a token pair that both the homeserver and the service read, and pointing the homeserver configuration at the file so it loads at startup. The Synapse configuration manual documents the settings involved, but confirm the exact key names and file format against the Synapse version you run, because configuration keys change between releases. Decide who owns the registration file, where the tokens are stored and how the restart is scheduled.
The namespace is the main control. Keep it limited to the users who join calls, because the appservice token can act for every user the namespace covers. Store the token where only the homeserver and the authorization service can read it, and do not reuse the homeserver's admin credentials. Before go-live, cut the network of a test participant during a call and confirm that their membership disappears from the other clients. Repeat that test after each Synapse upgrade, and read the upgrade notes first. The Synapse upgrade notes warn that rolling back can be difficult because of database schema changes, so a failed upgrade that also changed the appservice setup should be handled as a restore from backup.
Security controls for the authorization path
The authorization service decides which users can open media for a call, so its controls sit on the path from client to LiveKit. The six controls below cover the shared secret, the homeservers it trusts, the SFU webhook, the public routes, the network, and the audit trail. Review them together, because a gap in one weakens the others.
Keep credentials out of config files
The service and LiveKit share a secret used to sign and verify call tokens, so anyone who reads it can mint access. Store the secret in your secrets manager or the orchestrator's secret store, inject it at runtime, and limit who can read it. Confirm with the project documentation how a rotation affects tokens already issued, then rotate on a schedule your team can execute. Check that the value never appears in container images, shell history, or CI logs.
Limit which homeservers get full access
Full access lets users from a homeserver obtain credentials for calls on your LiveKit deployment, so the allowed list should contain only homeservers you operate or have agreed to trust. Write the list from your intended federation partners and review it whenever a partner is added or removed. Synapse's federation whitelist is a separate setting, so check that the two lists agree.
Synapse configuration manualProtect the SFU webhook endpoint
The webhook is how LiveKit reports participant events back to the authorization service, so it must not accept requests from anywhere else. Keep it off the public internet and allow traffic only from the LiveKit server's address. Verify whatever authentication the project and LiveKit document for webhook calls, and test that an unauthenticated request is refused.
Expose only required proxy paths
The reverse proxy should forward only the paths that clients and LiveKit need for the authorization flow, and return errors for everything else. Keep administrative, metrics, and health endpoints on internal addresses. Build the path list from the documentation for your installed version, then test each forwarded route from outside your network and confirm the webhook path is not reachable there.
TLS and network isolation
Terminate TLS at the proxy with valid certificates, and keep traffic between the proxy, the service, and LiveKit on private network paths. Confirm which ports LiveKit needs for signaling and media, and whether any TURN traffic reaches the SFU without passing your proxy. Bind the service to an internal interface, and firewall the Synapse federation listener (port 8448 by default) separately from the call services.
Log and review authorization decisions
Record each token request with the user ID, homeserver, room, and outcome so you can trace who joined a call and why a request was refused. Never log the token itself or the shared secret. Forward logs to a central store with retention that matches your policy, and alert on bursts of refusals or requests from homeservers outside the allowed list. Confirm the log fields your version emits, since the project defines them.
Questions buyers ask before deploying lk-jwt-service
What drives the cost and effort of an lk-jwt-service deployment?
The main drivers are how much of the stack already exists and how many parts must change. If LiveKit is running and your Synapse homeservers are stable, the work is mostly configuring the authorization service, its credentials, the reverse proxy paths and the SFU webhook. Effort rises when you add homeservers, need appservice registration, run several reverse proxies, or must test calls across many clients and networks. Cost has two parts: a one-time build and handover, and recurring upgrades and testing if you want a retainer. Ask for a quote built from a written scope that lists each homeserver, proxy and environment, and states what is excluded.
How long does it take to deploy lk-jwt-service next to LiveKit?
The duration depends on the same drivers as cost: the number of homeservers, whether LiveKit and Synapse are already working for calls, the access your team can grant quickly, and whether appservice mode is in scope. Work that waits on DNS changes, certificate issuance or change approval often takes longer than the configuration itself. Ask for a timeline in the written scope that separates preparation, build, call testing across networks and handover, and that names which dependencies belong to your team. A timeline without those dependencies should not be relied on.
What must our internal team provide before an lk-jwt-service engagement starts?
Your team should be ready to provide the following before work begins:
- DNS records for the hostname that serves the authorization service and LiveKit, plus the server name used by your Synapse homeservers.
- TLS certificates for those hostnames, and a decision on who renews them.
- Change access to the reverse proxy so the required paths can be routed to the right services.
- Synapse admin access, including the configuration files and a way to restart or reload the homeserver.
- Access to the hosts or cluster where LiveKit and the authorization service will run, and to the credentials store.
Confirm each item against your own environment, because the exact paths and settings depend on your proxy and Synapse layout.
Can our own engineers deploy lk-jwt-service without an implementation partner?
Yes, if your engineers already run Synapse, manage a reverse proxy and operate LiveKit, and they have time to test calls across the networks your users actually use. The hardest parts are usually not the initial service start but the credentials, the proxy path rules, the webhook wiring and the appservice setup, where a small mistake can look like a call that connects for some users and fails for others. If one of those areas is new to your team, a fixed-scope engagement can cover the build and a handover, and a retainer can cover later upgrades. Decide based on who will own the setup after go-live.
When is appservice mode needed for delegated leave events?
Appservice mode is needed when the authorization path must send membership changes on behalf of users, such as a leave event that should follow an SFU webhook after a participant drops out of a call. Without it, the call can keep showing a participant as present after they have left. Whether your deployment needs it depends on the lk-jwt-service version and the call flow you intend to support, so check the project documentation for the exact events it sends. Once registered, the appservice holds a privileged token on your homeserver, so treat its registration file and secret as high-value credentials and limit who can read them.
How do Synapse and LiveKit upgrades affect the call path?
Each upgrade can change how calls authorize, route and tear down, so test the full call path after every change, not only the homeserver login. Read the Synapse upgrade notes for every release between your current version and the target, because the notes flag schema changes and platform floors. Those notes also warn that rolling back can be difficult after database schema changes, so take a backup before you upgrade. Upgrade one component at a time where possible, and confirm that the authorization service version still matches the LiveKit and Synapse versions you run.
What security evidence should we expect from an lk-jwt-service setup?
Expect a documented list of the credentials, which homeservers hold full access, which proxy paths are exposed, and which ports are open between LiveKit, the authorization service and your homeservers. Reviewers will also ask how secrets are stored and rotated, who can read the appservice registration, and which logs show authorization and webhook activity. DeployOpen prepares configuration, access records and test evidence for your own assessors, but it does not issue audit reports or certifications. Ask for these items to be named as deliverables in the written scope so the security review is not left to find them later.
What do we receive at the end of a fixed-scope lk-jwt-service engagement?
A fixed-scope engagement ends with the deliverables agreed in writing before work starts, which should include the configured services, the proxy and DNS changes, the credential and access records, call test results and operating notes for your team. Ask for a handover session and a list of what is excluded, such as TURN setup or Element client changes, which belong to other work. If you want help with later upgrades, continuous testing or changes to the call path, those are available as a retainer and should be scoped separately from the build.
Deciding between your own team and a partner
Platform and security leads should decide early whether their own team can own lk-jwt-service alongside LiveKit, because the component is small but sits on the call path between Synapse, the reverse proxy and the LiveKit SFU. Running it well requires working knowledge of Synapse's OpenID and federation settings, reverse proxy routing for the paths Element Call uses, LiveKit's room and webhook model, and enough identity understanding to explain which homeservers are trusted to issue join credentials. A team that already runs Synapse and a reverse proxy may cover most of this, but the combination is less common than either skill alone, and the failure modes often look like client-side call bugs rather than server faults.
The work does not end at go-live. After the first working call, someone must track LiveKit and lk-jwt-service versions together, rotate the shared credentials, watch the webhook endpoint, and re-test calls after every Synapse or proxy change. Confirm with the project release notes which versions are compatible before you commit to a schedule, and ask any partner how they will handle upgrades in a supported window. Ongoing operation is usually the cost that surprises internal teams most, so ask whether the retainer or internal rota will cover call failures outside office hours.
When you request a fixed-scope written proposal, ask for the list of homeservers that will be allowed full access and who approves changes to it, the reverse proxy paths and TLS arrangement, the webhook and credential handling, the appservice mode decision for delegated leave events, and the test cases used to prove a group call works from two networks. Ask what is excluded, such as LiveKit TURN hosting or Synapse upgrades, and what is delivered as documentation for your operators. A clear written scope lets you compare a partner against the cost of your own team's time, which is the honest baseline for the decision.
What a DeployOpen engagement covers for this service
A DeployOpen engagement for lk-jwt-service is agreed in writing before work starts. The cards below follow the work in order: what is scoped, how the service is built in your infrastructure, how it joins Synapse and your proxies, how calls are tested, what you receive, and what happens after go-live.
Scoping the deployment
We confirm the homeservers that will use the authorization service, the LiveKit deployment it signs tokens for, and the public hostnames each component answers on. We also agree who owns the shared secret and key material, and where the service runs relative to Synapse. The written scope names these inputs, so a quote reflects real decisions rather than assumptions. Ask us to confirm which homeservers are included and how many environments need separate credentials.
Build in your infrastructure
We install and configure lk-jwt-service in the cloud accounts, data center or isolated network you operate, next to your existing LiveKit service. Credentials are created and stored in your secrets tooling, not in configuration files shared between teams. We document the service unit or container definition, the restart behavior and the network paths it needs. Confirm that your platform team can review every resource we create.
Synapse and reverse proxy integration
We wire the service into the reverse proxy paths that clients call and check that Synapse can reach the authorization endpoint it depends on. Each route is tested for the expected status codes, TLS termination, and header handling, so a misrouted path does not look like a client bug. We also review how the proxy forwards requests from the homeserver domains you listed. Ask for the exact route table before go-live.
Join and leave flow testing
We test the full call lifecycle with real Matrix accounts on each homeserver in scope: joining a session, reconnecting after a dropped connection, and leaving. The SFU webhook is exercised so that participant removal and delegated leave events are confirmed on the server side. Each failure found is recorded with the log line, the request and the fix. Ask us which accounts, browsers and client versions the test plan covers.
Documentation and handover
You receive a runbook covering the configuration keys, credential rotation steps, proxy routes, webhook setup, logs to read first and the known failure modes found during testing. Your team walks through a live join and leave with us before we close the engagement. The document describes what was built in your environment, so it stays useful after the project team leaves. Confirm the format and review cycle in the written scope.
Retainer support for upgrades
Because lk-jwt-service sits between Synapse, LiveKit and your proxies, a version change in any of them can break call setup. An optional retainer covers reviewing release notes, testing upgrades in a staging environment and applying them in your production window. Costs recur under a retainer, while the initial build is one-time. Ask for the response expectations and the upgrade process in writing before you sign.
How DeployOpen scopes and delivers Matrix call infrastructure
DeployOpen plans, builds, documents and supports self-hosted open-source platforms inside the client's own infrastructure, including the lk-jwt-service authorization layer that sits between a Matrix homeserver and a LiveKit SFU. Work starts from a written scope that covers the homeserver, LiveKit and reverse proxy paths before any configuration changes are made.
How we scope
- Engagements are fixed-scope, with deliverables and timelines agreed in writing before work starts.
- The written scope lists which homeservers, domains and LiveKit instances the authorization service will serve.
- Scope records how the SFU webhook, credential storage and reverse proxy routes will be handled and who owns each.
How we build
- We install lk-jwt-service beside LiveKit in your environment and configure its key and secret handling.
- We set the reverse proxy paths and test that clients reach the authorization endpoints over TLS.
- We verify delegated leave event behavior and test appservice mode where the design needs it before go-live.
How we hand over
- You receive configuration records, credential locations, proxy route maps and the webhook setup as documentation.
- Runbooks describe restart order, secret rotation steps and how to confirm a call still connects after changes.
- Handover includes a walkthrough with your platform and security engineers, covering the test evidence collected.
How we support
- Ongoing support, upgrades and continuous testing are available as retainers after handover.
- Retainers can cover version upgrades of lk-jwt-service and LiveKit, with changes reviewed against your scope.
- Ask any provider to confirm how they track upstream release notes and which environments they can test against.

