public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
    {
        $this->dispatcher->dispatch(self::OAUTH_LOGIN_FAILURE, new AuthFailedEvent($request, $exception));

        return $this->removeAuthCookieFromResponse(new Response(
            $this->twig->render('@StarterKitStart/oauth-failure.html.twig', ['login_path' => $this->loginPath])
        ));
    }
public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
    {
        $this->dispatcher->dispatch(self::OAUTH_LOGIN_FAILURE, new AuthFailedEvent($request, $exception));

        return $this->removeAuthCookieFromResponse(new Response(
            $this->twig->render('@StarterKitStart/oauth-failure.html.twig', ['login_path' => $this->loginPath])
        ));
    }
public function onAuthenticationFailure ( Request $ request , AuthenticationException $ exception ) { $ this -> dispatcher -> dispatch ( self :: OAUTH_LOGIN_FAILURE , new AuthFailedEvent ( $ request , $ exception ) ) ; return $ this -> removeAuthCookieFromResponse ( new Response ( $ this -> twig -> render ( '@StarterKitStart/oauth-failure.html.twig' , [ 'login_path' => $ this -> loginPath ] ) ) ) ; }
5a) Returns a 403.

The page rendered will redirect the user to the login page.  This happens when third party api fails.

@param Request $request
@param AuthenticationException $exception
@return Response
5a ) Returns a 403 .