Configure authentication, 2FA, OAuth, and security features in Firefly III
Firefly III provides robust security features including multi-factor authentication, OAuth support, and flexible authentication methods. This guide covers security configuration and best practices.
Enter the current 6-digit code from your authenticator app
Alternatively, use one of your backup codes
Code Reuse PreventionFirefly III tracks recently used codes for 5 minutes to prevent replay attacks. If you submit the same code twice within 5 minutes, it will be rejected even if valid.
If you lose access to your authenticator device and backup codes:
Self-Hosted
Hosted Instance
If you have server access, reset 2FA via command line:
# Connect to your databasemysql -u firefly -p firefly# Find the user IDSELECT id, email FROM users WHERE email = 'user@example.com';# Clear the MFA secretUPDATE users SET mfa_secret = NULL WHERE id = <user_id>;
Contact your Firefly III administrator (the site owner specified in .env as SITE_OWNER) and request a 2FA reset.Administrators should verify the user’s identity before resetting their 2FA.
Firefly III logs important MFA events to the audit log:
// Logged events- User has enabled MFA- User has disabled MFA- User has generated new backup codes- User has used a backup code- User has few backup codes left (3 or fewer)- User has no backup codes left- User has had multiple failed MFA attempts (3, 10)
Enable audit logging in .env:
# Enable audit logAUDIT_LOG_LEVEL=info# Optional: separate audit log channelAUDIT_LOG_CHANNEL=audit_daily
Provide your own OAuth keys via environment variables:
.env
# Custom OAuth keys (not recommended for most users)PASSPORT_PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\n..."PASSPORT_PUBLIC_KEY="-----BEGIN PUBLIC KEY-----\n..."# Or use files (recommended for Docker secrets)PASSPORT_PRIVATE_KEY_FILE=/run/secrets/oauth_private_keyPASSPORT_PUBLIC_KEY_FILE=/run/secrets/oauth_public_key
Only use custom OAuth keys if you understand the security implications. The default key generation is secure for most installations.
Only disable frame headers if you’re embedding Firefly III in trusted applications like Organizr. This increases vulnerability to clickjacking attacks.
# Cookie pathCOOKIE_PATH="/"# Domain for cookies (usually leave empty)COOKIE_DOMAIN=# Require HTTPS for cookies (enable in production)COOKIE_SECURE=false# SameSite policy (lax or strict)COOKIE_SAMESITE=lax
Production SettingsFor HTTPS deployments:
COOKIE_SECURE=trueCOOKIE_SAMESITE=strict
Setting COOKIE_SAMESITE=strict may cause login issues. Use lax unless you understand the implications.