Documentation Index
Fetch the complete documentation index at: https://mintlify.com/AssemblyAI/realtime-transcription-browser-js-example/llms.txt
Use this file to discover all available pages before exploring further.
generateTempToken()
Generates a temporary authentication token for AssemblyAI’s real-time transcription API.Function Signature
tokenGenerator.js:4
Parameters
The number of seconds until the token expires. Maximum value is 600 seconds (10 minutes).
Return Value
Returns aPromise<string> that resolves to the temporary authentication token.
Error Handling
The function throws an error if:- The AssemblyAI API key is missing or invalid
- The API request fails due to network issues
- The AssemblyAI token generation endpoint is unavailable
Implementation
The function makes an HTTP GET request to AssemblyAI’s token generation endpoint:Environment Variables
Your AssemblyAI API key. Must be set in the
.env file and loaded via dotenv.Usage Example
Integration
This function is used by the Express server inserver.js:12 to provide tokens to the client application: