Package
filament/filament
Package Version
v5.0.0
Laravel Version
v.12+
Livewire Version
No response
PHP Version
8.4
Problem description
Even I am adding 2fa code from both email and authenticator app. Its always asking for 2FA code.
http://shares.profitablemedia.com/20260117r954068b350.png
Here is my User Model:
`
namespace App\Models;
use Filament\Models\Contracts\FilamentUser;
use Filament\Panel;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
// Filament v4 MFA Interfaces
use Filament\Auth\MultiFactor\App\Contracts\HasAppAuthentication;
use Filament\Auth\MultiFactor\App\Contracts\HasAppAuthenticationRecovery;
// Filament v4 MFA Traits
use Filament\Auth\MultiFactor\App\Concerns\InteractsWithAppAuthentication;
use Filament\Auth\MultiFactor\App\Concerns\InteractsWithAppAuthenticationRecovery;
use Filament\Auth\MultiFactor\Email\Contracts\HasEmailAuthentication;
use Filament\Auth\MultiFactor\Email\Concerns\InteractsWithEmailAuthentication;
use Illuminate\Contracts\Auth\MustVerifyEmail;
class User extends Authenticatable implements FilamentUser, HasEmailAuthentication, MustVerifyEmail, HasAppAuthentication, HasAppAuthenticationRecovery
{
use HasFactory, Notifiable;
use InteractsWithEmailAuthentication;
use InteractsWithAppAuthentication;
use InteractsWithAppAuthenticationRecovery;
/**
* Determine if the user can access the given Filament panel.
*/
public function canAccessPanel(Panel $panel): bool
{
// Add your authorization logic here (e.g., email domain check)
return true;
}
/**
* Determine if the user has app-based MFA enabled.
* This method is required by the HasAppAuthentication interface.
*/
public function hasAppAuthentication(): bool
{
return (bool) $this->has_app_authentication;
}
protected $fillable = [
'name',
'email',
'password',
'app_authentication_secret',
'app_authentication_recovery_codes',
'has_app_authentication',
'has_email_authentication', // Ensure this is inside the array
]; // Remove the extra bracket from the middle
protected $hidden = [
'password',
'remember_token',
'app_authentication_secret',
'app_authentication_recovery_codes',
];
/**
* Corrected casts for 2026 standards.
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
'has_app_authentication' => 'boolean',
'has_email_authentication' => 'boolean', // Add this line
'app_authentication_recovery_codes' => 'encrypted:array',
];
}
public function getAppAuthenticationSecret(): ?string
{
return $this->app_authentication_secret;
}
public function saveAppAuthenticationSecret(?string $secret): void
{
$this->app_authentication_secret = $secret;
$this->save();
}
public function getAppAuthenticationHolderName(): string
{
return $this->email;
}
public function hasEmailAuthentication(): bool
{
return (bool) $this->has_email_authentication;
}
// Ensure this is also present to tell Filament where to send the code
public function getEmailAuthenticationAddress(): string
{
return $this->email;
}
}
`
What's wrong there?
Expected behavior
Never works
Steps to reproduce
After trying to setup 2FA code, Code accepting the code and not posting as well
Reproduction repository (issue will be closed if this is not valid)
https://github.com/pmediavictor/filament-2fa-code-issue
Relevant log output
Package
filament/filament
Package Version
v5.0.0
Laravel Version
v.12+
Livewire Version
No response
PHP Version
8.4
Problem description
Even I am adding 2fa code from both email and authenticator app. Its always asking for 2FA code.
http://shares.profitablemedia.com/20260117r954068b350.png
Here is my User Model:
`
namespace App\Models;
use Filament\Models\Contracts\FilamentUser;
use Filament\Panel;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
// Filament v4 MFA Interfaces
use Filament\Auth\MultiFactor\App\Contracts\HasAppAuthentication;
use Filament\Auth\MultiFactor\App\Contracts\HasAppAuthenticationRecovery;
// Filament v4 MFA Traits
use Filament\Auth\MultiFactor\App\Concerns\InteractsWithAppAuthentication;
use Filament\Auth\MultiFactor\App\Concerns\InteractsWithAppAuthenticationRecovery;
use Filament\Auth\MultiFactor\Email\Contracts\HasEmailAuthentication;
use Filament\Auth\MultiFactor\Email\Concerns\InteractsWithEmailAuthentication;
use Illuminate\Contracts\Auth\MustVerifyEmail;
class User extends Authenticatable implements FilamentUser, HasEmailAuthentication, MustVerifyEmail, HasAppAuthentication, HasAppAuthenticationRecovery
{
use HasFactory, Notifiable;
use InteractsWithEmailAuthentication;
use InteractsWithAppAuthentication;
use InteractsWithAppAuthenticationRecovery;
}
`
What's wrong there?
Expected behavior
Never works
Steps to reproduce
After trying to setup 2FA code, Code accepting the code and not posting as well
Reproduction repository (issue will be closed if this is not valid)
https://github.com/pmediavictor/filament-2fa-code-issue
Relevant log output