Auth Tokens
For production apps, use a short-lived auth token instead of embedding your Convai API key in client-side code. The API key stays on your server; the client receives a token that expires after 1 hour.
Why auth tokens matter
Flow
Client Your server Convai API
| | |
| "start conversation" | |
|-----------------------> | |
| | POST /user/connect |
| | CONVAI-API-KEY: ... |
| |----------------------->|
| | { apiAuthToken, ... } |
| |<-----------------------|
| { authToken } | |
|<----------------------- | |
| | |
| new ConvaiClient({ authToken }) |
|------------------------------------------------->|1. Generate a token (server-side)
2. Use the token in the SDK
3. Extend a token
4. Revoke a token
API reference
ConvaiConfig
ConvaiConfigField
Type
Description
Token endpoints
Endpoint
Description
Last updated
Was this helpful?