src/EventListener/UserProviderListener.php
public function onGetUser(GetUserForTokenEvent $event)
    {
        $userProvider = $event->getUserProvider();

        if (!$userProvider instanceof OAuthUserProviderInterface) {
            return;
        }

        $token = $event->getToken();

        if ($user = $userProvider->loadUserByOAuthCredentials($token)) {
            $token->setUser($user);
        }
    }
public function onGetUser(GetUserForTokenEvent $event)
    {
        $userProvider = $event->getUserProvider();

        if (!$userProvider instanceof OAuthUserProviderInterface) {
            return;
        }

        $token = $event->getToken();

        if ($user = $userProvider->loadUserByOAuthCredentials($token)) {
            $token->setUser($user);
        }
    }
public function onGetUser ( GetUserForTokenEvent $ event ) { $ userProvider = $ event -> getUserProvider ( ) ; if ( ! $ userProvider instanceof OAuthUserProviderInterface ) { return ; } $ token = $ event -> getToken ( ) ; if ( $ user = $ userProvider -> loadUserByOAuthCredentials ( $ token ) ) { $ token -> setUser ( $ user ) ; } }
Populate the security token with a user from the local database.

@param GetUserForTokenEvent $event
Populate the security token with a user from the local database .