AmityUserTokenManager or the TypeScript createUserToken(...) helper to create user credentials for flows that require a user access token. This includes access to some beta features and server-side API workflows.
Parameters
Create a user token
To create a user token, pass the user’s identifier and optional secure-mode credentials from a trusted workflow. Create the token with the SDK surface for your platform.Token security
Secure storage
Secure storage
- Store tokens securely on the server side.
- Use encryption for token storage.
- Implement token rotation policies.
- Never expose tokens in client-side code.
Network security
Network security
- Always use HTTPS for token transmission.
- Implement proper authentication headers.
- Use secure communication channels.
- Log token usage for audit purposes.
Best Practices
Token management
Token management
- Cache tokens to avoid unnecessary creation.
- Implement token validation before usage.
- Use connection pooling for better performance.
- Handle token expiration gracefully.
Error handling
Error handling
- Implement comprehensive error handling.
- Log all token operations for debugging.
- Provide meaningful error messages.
- Implement retry logic for transient failures.
Performance
Performance
- Batch token operations when possible.
- Use background processing for token creation.
- Implement caching strategies.
- Monitor token usage patterns.
Related Topics
User Authentication
Learn about standard user login and authentication.
API Integration
Explore social.plus API documentation.