Skip to main content
Instead of connecting directly to Corti, you can route the WebSocket through your own proxy. When socketUrl or socketProxy is set, accessToken and authConfig are ignored — your proxy handles authentication.

Why proxy?

When using Client Credentials authentication, the token is a service-account token with access to all data within the same API Client. Exposing it in a browser means any user could access any other user’s data. Best practice: use the SDK on the backend only, and call your own backend endpoints from the frontend. If you need the SDK in the browser, proxy through your server so credentials never leave the backend.
If proxying is not an option, consider scoped tokens to restrict what a frontend token can access.

Using socketUrl

Point the component at your proxy endpoint:
<corti-dictation socketUrl="wss://your-proxy.com/transcribe"></corti-dictation>

Using socketProxy

For additional control over subprotocols and query parameters:
const dictation = document.querySelector("corti-dictation");

dictation.socketProxy = {
    url: "wss://your-proxy.com/transcribe",
    protocols: ["your-protocol"],
    queryParameters: { userId: "123" },
};
FieldTypeRequiredDescription
urlstringYesWebSocket proxy URL
protocolsstring[]NoWebSocket subprotocols
queryParametersobjectNoQuery parameters appended to the URL

Using with modular components

Set socketUrl or socketProxy on <dictation-root>:
<dictation-root socketUrl="wss://your-proxy.com/transcribe">
    <dictation-recording-button></dictation-recording-button>
</dictation-root>

See also