Controller/AdminController.php
public function authenticateAction(Request $request, $name)
    {
        /* @var \Google_Client $client */
        $clientProvider = $this->get('happyr.google_site_authenticator.client_provider');
        $client = $clientProvider->getClient($name);

        // This will allow us to get refresh the token
        $client->setAccessType('offline');
        $client->setApprovalPrompt('force');

        $request->getSession()->set(self::SESSION_KEY, $name);

        return $this->redirect($client->createAuthUrl());
    }
public function authenticateAction(Request $request, $name)
    {
        /* @var \Google_Client $client */
        $clientProvider = $this->get('happyr.google_site_authenticator.client_provider');
        $client = $clientProvider->getClient($name);

        // This will allow us to get refresh the token
        $client->setAccessType('offline');
        $client->setApprovalPrompt('force');

        $request->getSession()->set(self::SESSION_KEY, $name);

        return $this->redirect($client->createAuthUrl());
    }
public function authenticateAction ( Request $ request , $ name ) { /* @var \Google_Client $client */ $ clientProvider = $ this -> get ( 'happyr.google_site_authenticator.client_provider' ) ; $ client = $ clientProvider -> getClient ( $ name ) ; // This will allow us to get refresh the token $ client -> setAccessType ( 'offline' ) ; $ client -> setApprovalPrompt ( 'force' ) ; $ request -> getSession ( ) -> set ( self :: SESSION_KEY , $ name ) ; return $ this -> redirect ( $ client -> createAuthUrl ( ) ) ; }
This action starts the authentication.

@param Request $request
@param $name

@return Response
This action starts the authentication .