AfterUserLoggedInEvent 

The purpose of the PSR-14 event \TYPO3\CMS\Core\Authentication\Event\AfterUserLoggedInEvent is to trigger any kind of action when a backend or frontend user has been successfully logged in.

The TYPO3 Core itself uses this event in the TYPO3 backend to send an email to a user, if the user has successfully logged in. See EXT:backend/Classes/Security/EmailLoginNotification.php (GitHub).

Example: React to the login of an administrator 

EXT:my_extension/Authentication/EventListener/MyEventListener.php
<?php

declare(strict_types=1);

namespace MyVendor\MyExtension\Authentication\EventListener;

use TYPO3\CMS\Core\Attribute\AsEventListener;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Authentication\Event\AfterUserLoggedInEvent;

#[AsEventListener(
  identifier: 'my-extension/after-user-logged-in',
)]
final readonly class MyEventListener
{
  public function __invoke(AfterUserLoggedInEvent $event): void
  {
    if (
      $event->getUser() instanceof BackendUserAuthentication
      && $event->getUser()->isAdmin()
    ) {
      // Do something like: Clear all caches after login
    }
  }
}
Copied!

API 

final class AfterUserLoggedInEvent
Fully qualified name
\TYPO3\CMS\Core\Authentication\Event\AfterUserLoggedInEvent

Event fired after a user has been actively logged in to backend (incl. possible MFA) or frontend.

getUser()
Returns
\TYPO3\CMS\Core\Authentication\AbstractUserAuthentication
getRequest()
Returns
?\Psr\Http\Message\ServerRequestInterface