Overview
API token management is a login authentication process that allows a social.plus user to access social.plus applications in a unified and streamlined environment. social.plus SDK providesAmityUserTokenManager
to manage user credentials. This includes an access token that can be used to access some Beta features.
Please be aware that we do not provide any API to support the usage of user tokens on the client SDK. To use this user token, you must interact with social.plus Server APIs with your own effort.
Create a User Token
To create a new user token, refer to the following example and the parameters below.Parameters
Parameter | Type | Required | Description |
---|---|---|---|
userId | String | ✅ | The unique identifier of the user whose credentials are being managed by the AmityUserTokenManager |
displayName | String | ❌ | The display name of the user. If provided, it will be associated with the user’s credentials |
authToken | String | ❌ | The user’s authentication token. If provided, it will be used to authenticate the user when accessing the social.plus application |
Implementation
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