protected function _getService(ServerRequest $request)
    {
        if ($this->_service !== null) {
            return $this->_service;
        }

        $serviceConfig = $this->getConfig('serviceConfig');
        if (empty($serviceConfig)) {
            Configure::load('social_auth');
            $serviceConfig = Configure::consume('SocialAuth');
        }

        $serviceConfig['redirectUri'] = Router::url([
            'plugin' => 'ADmad/SocialAuth',
            'controller' => 'Auth',
            'action' => 'callback',
        ], true);

        $request->getSession()->start();

        $httpClient = $this->getConfig('httpClient');
        if (is_string($httpClient)) {
            $httpClient = new $httpClient();
        }

        $this->_service = new Service(
            $httpClient,
            new Session(),
            $serviceConfig
        );

        return $this->_service;
    }
protected function _getService(ServerRequest $request)
    {
        if ($this->_service !== null) {
            return $this->_service;
        }

        $serviceConfig = $this->getConfig('serviceConfig');
        if (empty($serviceConfig)) {
            Configure::load('social_auth');
            $serviceConfig = Configure::consume('SocialAuth');
        }

        $serviceConfig['redirectUri'] = Router::url([
            'plugin' => 'ADmad/SocialAuth',
            'controller' => 'Auth',
            'action' => 'callback',
        ], true);

        $request->getSession()->start();

        $httpClient = $this->getConfig('httpClient');
        if (is_string($httpClient)) {
            $httpClient = new $httpClient();
        }

        $this->_service = new Service(
            $httpClient,
            new Session(),
            $serviceConfig
        );

        return $this->_service;
    }
protected function _getService ( ServerRequest $ request ) { if ( $ this -> _service !== null ) { return $ this -> _service ; } $ serviceConfig = $ this -> getConfig ( 'serviceConfig' ) ; if ( empty ( $ serviceConfig ) ) { Configure :: load ( 'social_auth' ) ; $ serviceConfig = Configure :: consume ( 'SocialAuth' ) ; } $ serviceConfig [ 'redirectUri' ] = Router :: url ( [ 'plugin' => 'ADmad/SocialAuth' , 'controller' => 'Auth' , 'action' => 'callback' , ] , true ) ; $ request -> getSession ( ) -> start ( ) ; $ httpClient = $ this -> getConfig ( 'httpClient' ) ; if ( is_string ( $ httpClient ) ) { $ httpClient = new $ httpClient ( ) ; } $ this -> _service = new Service ( $ httpClient , new Session ( ) , $ serviceConfig ) ; return $ this -> _service ; }
Get social connect service instance.

@param \Cake\Http\ServerRequest $request Request instance.

@return \SocialConnect\Auth\Service
Get social connect service instance .