Session Tokens
In the TypeScript SDK, session tokens are the short-lived credentials that CSVImporter uses to open and keep the importer authenticated in the browser without exposing your long-lived secret key.
Implement getSessionToken() so it returns a fresh token from your backend:
Avoid:
- storing the ExpressCSV secret key in frontend code
- caching import session tokens for reuse across imports
- reusing an old token from local storage or a database
How to implement the session endpoint
Your backend session endpoint should call POST https://api.expresscsv.com/v1/importer/sessions with your environment secret key and return only the resulting token to the browser.
The example below uses Koa, but the same pattern applies in any backend framework.
If token creation or refresh fails, the importer surfaces an error and the import can be retried after the underlying backend or access issue is resolved.