src/Auth/HybridAuthAuthenticate.php
protected function _init(Request $request)
    {
        if ($this->_initDone) {
            return;
        }

        $this->_userModel = TableRegistry::get($this->_config['userModel']);
        $this->_profileModel = TableRegistry::get($this->_config['profileModel']);

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

        $hybridConfig = Configure::read('HybridAuth');

        if (empty($hybridConfig['base_url'])) {
            $hybridConfig['base_url'] = [
                'plugin' => 'ADmad/HybridAuth',
                'controller' => 'HybridAuth',
                'action' => 'endpoint',
                'prefix' => false
            ];
        }

        $hybridConfig['base_url'] = $this->_appendRedirectQueryString(
            $hybridConfig['base_url'],
            $request->query(static::QUERY_STRING_REDIRECT)
        );

        $hybridConfig['base_url'] = Router::url($hybridConfig['base_url'], true);

        try {
            Hybrid_Auth::initialize($hybridConfig);
        } catch (\Exception $e) {
            if ($e->getCode() < 5) {
                throw new \RuntimeException($e->getMessage());
            } else {
                $this->_registry->Auth->flash($e->getMessage());
                Hybrid_Auth::initialize($hybridConfig);
            }
        }
    }
protected function _init(Request $request)
    {
        if ($this->_initDone) {
            return;
        }

        $this->_userModel = TableRegistry::get($this->_config['userModel']);
        $this->_profileModel = TableRegistry::get($this->_config['profileModel']);

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

        $hybridConfig = Configure::read('HybridAuth');

        if (empty($hybridConfig['base_url'])) {
            $hybridConfig['base_url'] = [
                'plugin' => 'ADmad/HybridAuth',
                'controller' => 'HybridAuth',
                'action' => 'endpoint',
                'prefix' => false
            ];
        }

        $hybridConfig['base_url'] = $this->_appendRedirectQueryString(
            $hybridConfig['base_url'],
            $request->query(static::QUERY_STRING_REDIRECT)
        );

        $hybridConfig['base_url'] = Router::url($hybridConfig['base_url'], true);

        try {
            Hybrid_Auth::initialize($hybridConfig);
        } catch (\Exception $e) {
            if ($e->getCode() < 5) {
                throw new \RuntimeException($e->getMessage());
            } else {
                $this->_registry->Auth->flash($e->getMessage());
                Hybrid_Auth::initialize($hybridConfig);
            }
        }
    }
protected function _init ( Request $ request ) { if ( $ this -> _initDone ) { return ; } $ this -> _userModel = TableRegistry :: get ( $ this -> _config [ 'userModel' ] ) ; $ this -> _profileModel = TableRegistry :: get ( $ this -> _config [ 'profileModel' ] ) ; $ request -> session ( ) -> start ( ) ; $ hybridConfig = Configure :: read ( 'HybridAuth' ) ; if ( empty ( $ hybridConfig [ 'base_url' ] ) ) { $ hybridConfig [ 'base_url' ] = [ 'plugin' => 'ADmad/HybridAuth' , 'controller' => 'HybridAuth' , 'action' => 'endpoint' , 'prefix' => false ] ; } $ hybridConfig [ 'base_url' ] = $ this -> _appendRedirectQueryString ( $ hybridConfig [ 'base_url' ] , $ request -> query ( static :: QUERY_STRING_REDIRECT ) ) ; $ hybridConfig [ 'base_url' ] = Router :: url ( $ hybridConfig [ 'base_url' ] , true ) ; try { Hybrid_Auth :: initialize ( $ hybridConfig ) ; } catch ( \ Exception $ e ) { if ( $ e -> getCode ( ) < 5 ) { throw new \ RuntimeException ( $ e -> getMessage ( ) ) ; } else { $ this -> _registry -> Auth -> flash ( $ e -> getMessage ( ) ) ; Hybrid_Auth :: initialize ( $ hybridConfig ) ; } } }
Initialize HybridAuth and this authenticator.

@param \Cake\Network\Request $request Request instance.
@return void
@throws \RuntimeException Incase case of unknown error.
Initialize HybridAuth and this authenticator .