postAuthenticate

The postAuthenticate hook is triggered after a user was authenticated. It passes the user object as argument and does not expect a return value.

Using the postAuthenticate hook has been deprecated and will no longer work in Contao 5.0. You can use the security.authentication.success event instead for example.

Parameters

  1. \Contao\User $user

    The user (object) which just has been authenticated.

Example

// src/EventListener/PostAuthenticateListener.php
namespace App\EventListener;

use Contao\CoreBundle\DependencyInjection\Attribute\AsHook;
use Contao\User;

#[AsHook('postAuthenticate')]
class PostAuthenticateListener
{
    public function __invoke(User $user): void
    {
        // Do something …
    }
}

References