From b32be68924ffd1b9dbe45332560eb0c9cb217068 Mon Sep 17 00:00:00 2001 From: Niels Swimberghe <3382717+Swimburger@users.noreply.github.com> Date: Mon, 6 May 2024 11:25:08 -0400 Subject: [PATCH] Update README.md --- README.md | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index e10384f..4a7cd05 100644 --- a/README.md +++ b/README.md @@ -227,18 +227,25 @@ const rt = client.realtime.transcriber({ }); ``` -You can also generate a temporary auth token for real-time. - -```typescript -const token = await client.realtime.createTemporaryToken({ expires_in = 60 }); -const rt = client.realtime.transcriber({ - token: token, -}); -``` - > [!WARNING] > Storing your API key in client-facing applications exposes your API key. -> Generate a temporary auth token on the server and pass it to your client. +> Generate a temporary auth token on the server and pass it to your client. +> _Server code_: +> ```typescript +> const token = await client.realtime.createTemporaryToken({ expires_in = 60 }); +> // TODO: return token to client +> ``` +> +> _Client code_: +> ```typescript +> import { RealtimeTranscriber } from "assemblyai"; +> // TODO: implement getToken to retrieve token from server +> const token = await getToken(); +> const rt = new RealtimeTranscriber({ +> token +> }); +> ``` + You can configure the following events.