Auth tokens
In the TypeScript SDK, auth tokens are the short-lived credentials that CSVImporter uses to keep the importer authenticated in the browser without exposing your long-lived secret key.
authToken is not the same as sessionId. The SDK generates a sessionId when the importer opens and uses it to group chunks, callbacks, and staging rows. The auth token only proves the browser is allowed to talk to ExpressCSV and may rotate during a long import.
Implement getAuthToken() so it returns a fresh token from your backend:
Client code should only receive short-lived auth tokens from your backend. If the secret is exposed, rotate it in the ExpressCSV dashboard and update your backend.
Choose the right environment key
Use the secret key for the environment where the importer will run.
-
Production
- Use for: live imports in your production deployment
- Plan requirement: paid plan required
- Usage: counts toward usage limits
- Import behavior: full live imports
-
Development
- Use for: local development, staging, and CI deployments
- Plan requirement: available on all teams
- Usage: unlimited test imports
- Import behavior: returns only the first 100 rows and shows a test mode banner
How to implement the session endpoint
Your backend session endpoint should:
- Call the Create Import Auth Token REST API with your environment secret key
- Return only the resulting
tokento the browser
The example below uses Hono, but the same pattern applies in any backend framework.