Skip to content

Commit

Permalink
Merge pull request #49 from AssemblyAI/Swimburger-patch-1
Browse files Browse the repository at this point in the history
Update README.md
  • Loading branch information
Swimburger committed May 6, 2024
2 parents 3d8bd1f + b32be68 commit 7981778
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit 7981778

Please sign in to comment.