public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey)
    {
        $user = $token->getUser();

        $this->dispatcher->dispatch(self::OAUTH_LOGIN_SUCCESS, new UserEvent($user));

        return $this->authResponseService->authenticateResponse($user,
            new Response($this->twig->render('@StarterKitStart/oauth-success.html.twig')));
    }
public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey)
    {
        $user = $token->getUser();

        $this->dispatcher->dispatch(self::OAUTH_LOGIN_SUCCESS, new UserEvent($user));

        return $this->authResponseService->authenticateResponse($user,
            new Response($this->twig->render('@StarterKitStart/oauth-success.html.twig')));
    }
public function onAuthenticationSuccess ( Request $ request , TokenInterface $ token , $ providerKey ) { $ user = $ token -> getUser ( ) ; $ this -> dispatcher -> dispatch ( self :: OAUTH_LOGIN_SUCCESS , new UserEvent ( $ user ) ) ; return $ this -> authResponseService -> authenticateResponse ( $ user , new Response ( $ this -> twig -> render ( '@StarterKitStart/oauth-success.html.twig' ) ) ) ; }
5a) Return an authorized response.

The page rendered will redirect the user to the home page.  We can't do the RedirectResponse.

@param Request $request
@param TokenInterface $token
@param string $providerKey
@return Response
5a ) Return an authorized response .