Ravish Mallya
07/15/2025, 7:58 AMMarvin
07/15/2025, 7:58 AMMarvin
07/15/2025, 7:58 AMserver.api.auth_string
configuration with your desired admin username and password in the format "admin:password"
.
- You can do this in several ways:
bash
# Option 1: Using environment variable
export PREFECT_SERVER_API_AUTH_STRING="admin:your_secure_password"
# Option 2: Using Prefect configuration
prefect config set server.api.auth_string="admin:your_secure_password"
2. Client Configuration
- Any clients connecting to your server must use the same authentication string:
bash
prefect config set api.auth_string="admin:your_secure_password"
3. Important Security Notes:
- Store the auth string securely (e.g., in a .env
file or Kubernetes secret)
- Make sure PREFECT_API_KEY
is not set in your environment or profile
- Consider enabling CSRF protection for additional security:
bash
prefect config set server.api.csrf_protection_enabled=true
4. Verify Configuration
After setting up authentication, test your connection to ensure it's working:
bash
prefect server status
For additional security, you can also configure CSRF token expiration (default is 1 hour):
bash
prefect config set server.api.csrf_token_expiration="2h" # Set to 2 hours
You can find more detailed information about security settings in the Prefect documentation.
Let me know if you need help with any specific aspect of the authentication setup or if you're running into any issues!