2

I'm at a loss here... I'm using Laravel 8 with the jetstream inertia stack. I've setup event listeners in my EventServiceProvider to log various authentication events but the events don't seem to fire as expected. Login and Logout both work as expected, but I can't figure out the logic behind Attempting and Failed. Attempting only seems to fire when I successfully login. If I pass an invalid email/password it never fires. And I can't seem to figure out when Failed ever fires. All I want to accomplish is logging attempts to login to my system, even if they are providing invalid credentials.

Here's my EventServiceProvider. All the listeners are very simple with just a line to log a message in the handle() method.

    protected $listen = [
        \Illuminate\Auth\Events\Attempting::class => [
            \App\Listeners\Auth\LogAttemptingLogin::class
        ],
        \Illuminate\Auth\Events\Login::class => [
            \App\Listeners\Auth\LogSuccessfulLogin::class,
        ],
        \Illuminate\Auth\Events\Logout::class => [
            \App\Listeners\Auth\LogSuccessfulLogout::class,
        ],
        \Illuminate\Auth\Events\Failed::class => [
            \App\Listeners\Auth\LogFailedLogin::class,
        ]
];
bb89
  • 793
  • 2
  • 8
  • 23

1 Answers1

2

I'm experiencing the same issues with exact same stack. It feels like LogFailedLogin not triggering is a bug or something.

I opened an issue as I'm having an hunch that it has to do with Fortify: https://github.com/laravel/fortify/issues/145.

Edit: It's a confirmed bug at the time of writing.

nckrtl
  • 21
  • 2
  • Thanks for submitting the bug report! I still haven't gotten this resolved. I'll keep an eye on your issue and try to update the post once there's a solution. – bb89 Nov 24 '20 at 14:07
  • 1
    It got fixed and merged, composer update should do the trick. – nckrtl Nov 24 '20 at 23:07