Prerequisites
Before setting up authentication, ensure you have:API Credentials
UIKit Installed
Get Your API Credentials
Access social.plus Console
Visit Console
Navigate to Security
Copy Credentials
Regional Configuration
social.plus operates in multiple regions for optimal performance and compliance:- United States
- Europe
- Singapore
Authentication Modes
social.plus UIKit supports two authentication modes depending on your security requirements:- Development Mode
- Production Mode
Learn About Auth Tokens
Device Registration
Understanding Device Binding
When you authenticate a user with social.plus UIKit, you’re registering the current device with that user’s ID. This device will receive all messages and notifications belonging to that user.Platform Implementation
Choose your platform for device registration:- iOS
- Android
- Web/React
- React Native
- Flutter
User Management
User ID Guidelines
Your user identification strategy is crucial for a smooth user experience:Unique Identification
Unique Identification
- Use your internal user ID or UUID
- Ensure IDs are unique across your entire user base
- Keep IDs consistent across all platforms
- Email addresses (users might change emails)
- Phone numbers (users might change numbers)
- Display names (not unique)
Character Requirements
Character Requirements
- Alphanumeric characters (a-z, A-Z, 0-9)
- Underscores (_) and hyphens (-)
- Maximum length: 255 characters
- Spaces or special characters (@, #, $, etc.)
- Emojis or unicode characters
Production Considerations
Production Considerations
- Don’t expose sensitive information in user IDs
- Consider hashing user IDs if needed
- Implement server-side validation
- Use a consistent ID format
- Plan for user merging scenarios
- Consider ID migration strategies
Session Management
User Login
Session Persistence
User Logout
- iOS
- Android
- Web/React
User Switching
Advanced Configuration
Environment Management
Organize your configuration for different environments:- Development
- Production
Error Handling
Implement comprehensive error handling for authentication:Backend Integration
For production applications, you’ll need to implement auth token generation on your backend:Backend Auth Token Implementation
Quick Backend Example
Here’s a simplified example of auth token generation:Troubleshooting
Authentication Failures
Authentication Failures
- Verify API key is correct and not truncated
- Check that the API key matches your console account
- Ensure no extra spaces or characters
- Verify auth token is properly generated by your backend
- Check token hasn’t expired
- Ensure token format matches social.plus requirements
- Verify region matches your console setup
- Check endpoint URLs are correct
- Confirm region code format (us/eu/sg)
Device Registration Issues
Device Registration Issues
- Unregister existing user first
- Wait for previous session to properly close
- Clear app data if needed (development only)
- Remove special characters and spaces
- Check user ID length (max 255 characters)
- Use only alphanumeric characters and underscores
- Ensure proper logout before switching users
- Check for multiple provider instances (Web/React)
- Verify device registration cleanup
Platform-Specific Issues
Platform-Specific Issues
- Ensure registration is called on main thread
- Check for proper app lifecycle handling
- Verify push notification setup if using
- Implement proper Activity/Fragment lifecycle
- Check for ProGuard/R8 obfuscation issues
- Verify session handler implementation
- Ensure single provider instance at app root
- Import CSS styles for proper component rendering
- Check for CORS issues in development
- Verify native module linking
- Check platform-specific permissions
- Test on physical devices for push notifications
- Check session handler implementation
- Verify platform permissions are configured
- Ensure proper async/await usage
Next Steps
Now that authentication is configured, you can explore social.plus UIKit features:Explore Components
Customize Appearance
Platform Guides
Authentication Deep Dive
User ID Guidelines
Your user identification strategy is crucial for a smooth user experience:Unique Identification
Unique Identification
- Use your internal user ID or UUID
- Ensure IDs are unique across your entire user base
- Keep IDs consistent across all platforms
- Email addresses (users might change emails)
- Phone numbers (users might change numbers)
- Display names (not unique)
Character Requirements
Character Requirements
- Alphanumeric characters (a-z, A-Z, 0-9)
- Underscores (_) and hyphens (-)
- Maximum length: 255 characters
- Spaces or special characters (@, #, $, etc.)
- Emojis or unicode characters
Production Considerations
Production Considerations
- Don’t expose sensitive information in user IDs
- Consider hashing user IDs if needed
- Implement server-side validation
- Use a consistent ID format
- Plan for user merging scenarios
- Consider ID migration strategies
Session Management
User Login
Session Persistence
User Logout
- iOS
- Android
- Web/React
User Switching
Advanced Configuration
Environment Management
Organize your configuration for different environments:- Development
- Production
- Enterprise
Error Handling
Implement comprehensive error handling for authentication:Security Best Practices
API Key Security
API Key Security
- Store API keys in environment variables
- Never commit API keys to version control
- Use different keys for development and production
- Implement server-side token generation
- Use short-lived authentication tokens
- Validate users on your backend before issuing tokens
User Validation
User Validation
- Validate user IDs before registration
- Sanitize display names
- Implement rate limiting for authentication attempts
- Monitor for unusual authentication patterns
- Implement proper logout flows
- Consider implementing session timeouts
Troubleshooting
Authentication Failures
Authentication Failures
- Verify API key is correct and not truncated
- Check that the API key matches your console account
- Ensure no extra spaces or characters
- Verify region matches your console setup
- Check endpoint URLs are correct
- Confirm region code format (us/eu/sg)
- Test internet connectivity
- Check firewall/proxy settings
- Verify DNS resolution for amity.co domains
User Registration Issues
User Registration Issues
- Remove special characters and spaces
- Check user ID length (max 255 characters)
- Use only alphanumeric characters and underscores
- Unregister existing user first
- Wait for previous session to properly close
- Clear app data if needed (development only)
- Ensure display name is not empty
- Check for special character restrictions
- Verify UTF-8 encoding for international names
Platform-Specific Issues
Platform-Specific Issues
- Ensure setup is called on main thread
- Check for proper delegate implementations
- Verify bundle identifier permissions
- Implement proper Activity/Fragment lifecycle
- Check for ProGuard/R8 obfuscation issues
- Verify network permissions in manifest
- Ensure provider wraps all UIKit components
- Check for CORS issues in development
- Verify React version compatibility
- Check platform-specific permissions
- Verify native module linking
- Test on physical devices, not just simulators
- Check pubspec.yaml dependencies
- Verify platform permissions are configured
- Test hot reload vs full restart
Next Steps
Now that authentication is configured, you can explore social.plus UIKit features:Explore Components
Customize Appearance
Platform Guides
View Examples
Initialize SDK
Application class or main activity:Register User
Launch UIKit
Web/React Setup
Initialize Provider
AmityUiKitProvider in your React app:Use Components
React Native Setup
Initialize Provider
Flutter Setup
Initialize App
AmityApp widget:Authentication Best Practices
User ID Guidelines
Unique Identification
Unique Identification
- Use a unique, persistent identifier for each user
- Avoid using email addresses or phone numbers directly
- Consider using UUIDs or your system’s internal user IDs
Consistency
Consistency
- Maintain the same user ID across app sessions
- Ensure user IDs remain consistent across different platforms
- Don’t change user IDs after initial registration
Security
Security
- Never expose sensitive user information in user IDs
- Use a hash or encoded value if needed
- Implement proper server-side validation
Session Management
Registration
Session Persistence
Logout
- iOS
- Android
Configuration Options
Optional Parameters
Custom Endpoints
Custom Endpoints
Authentication Tokens
Authentication Tokens
Environment Configuration
- Development
- Production
Troubleshooting
Authentication Errors
Authentication Errors
User Registration Issues
User Registration Issues
Platform-Specific Issues
Platform-Specific Issues