Overview
TheStudioAccessConfig type controls who can access the Studio UI. You can restrict access by user roles, specific email addresses, configure session duration, and set a custom secret for authentication.
Type Definition
Fields
Array of user roles that are allowed to access Studio.Users must have one of these roles in their Better Auth user object to access the Studio UI.Example:
Array of specific email addresses that are allowed to access Studio.Users with these email addresses can access Studio regardless of their role.Example:
Duration of Studio authentication sessions in seconds.Controls how long users stay authenticated in Studio before needing to re-authenticate.Example:
Custom secret for Studio authentication.Used to sign and verify Studio session tokens. If not provided, Studio will use a default secret.Recommendation: Provide a strong, unique secret in production environments.Example:
Usage Examples
Restrict by Role
Allow Specific Emails
Combined Access Control
Development vs Production
Security Considerations
- Use roles or allowEmails to limit access to trusted users only
- Set a custom secret in production using environment variables
- Keep sessionDuration reasonable - shorter durations are more secure
- Avoid hardcoding secrets - use environment variables instead
Related
- StudioConfig - Main configuration object
- StudioMetadata - Customization and branding