is there anyone use hybridAuth ?

On Friday, June 7, 2013 9:50:31 AM UTC+7, Norris wrote:
>
> Hi everyone, i'm trying to crate log in with facebook on my cake site. I 
> add HybridAuth to cake as a component. The login is success but whenever 
> i'm tryin to log out an error occurs 
>
>
> "Fatal error: Call to a member function logout() on a non-object in 
> /var/www/site.demo/app/vendors/hybridAuth/Hybrid/Provider_Adapter.php on 
> line 153"
>
>
> /-------------------------------------------------------------------------------------------------------------------/
> hybrid_auth component
>
> class hybridAuthComponent extends Object
> {
>     private $hybrid_Auth ;
>     public $adapter;
>     public $error;
>     
>     function initialize(&$controller,$settings = array())
>     {
>         $this->controller = &$controller;    
>         App::import("Vendor", "hybridauth", array("file" => 
> "Hybrid/Auth.php"));
>         
>         $hybridauth_config = array(
> "base_url" => 'http://'.$_SERVER['HTTP_HOST'] . 
> "/app/vendors/hybridAuth/", // well watev, set yours
>
> "providers" => array ( 
> "Facebook" => array (
> "enabled" => true,
> "keys"    => array ( "id" => "110452372497767", "secret" => 
> "8901c51b79c4d24705da96660ea75192" ),
> "scope"   => null, 
> )
> )
> ); 
>
> try
>         {
> // create an instance for Hybridauth with the configuration file path as 
> parameter
> $this->hybrid_Auth = new Hybrid_Auth( $hybridauth_config );
>       }
> catch( Exception $e )
>         {
> // Display the recived error
> switch( $e->getCode() ){ 
> case 0 : $error = "Unspecified error."; break;
> case 1 : $error = "Hybriauth configuration error."; break;
> case 2 : $error = "Provider not properly configured."; break;
> case 3 : $error = "Unknown or disabled provider."; break;
> case 4 : $error = "Missing provider application credentials."; break;
> case 5 : $error = "Authentification failed. The user has canceled the 
> authentication or the provider refused the connection."; break;
> case 6 : $error = "User profile request failed. Most likely the user is 
> not connected to the provider and he should to authenticate again."; 
>      $adapter->logout(); 
>      break;
> case 7 : $error = "User not connected to the provider."; 
>      $adapter->logout(); 
>      break;
> } 
>
> // well, basically your should not display this to the end user, just give 
> him a hint and move on..
> $error .= "<br /><br /><b>Original error message:</b> " . 
> $e->getMessage(); 
> $error .= "<hr /><pre>Trace:<br />" . $e->getTraceAsString() . "</pre>";  
>
> $this->error = $error;
> }    
>     } 
>     
>     function connect($provider)
>     {
>         
>
> // try to authenticate the selected $provider
> $this->adapter = $this->hybrid_Auth->authenticate( $provider );
>             //echo '<pre>';print_r($this->adapter);echo '</pre>';
>             echo '<pre>';print_r(Hybrid_Auth::getSessionData());echo 
> '</pre>';
>             
> // grab the user profile
> $user_profile = $this->adapter->getUserProfile();
>  return $user_profile ;
>     }
>     
>     function logout() 
>     {
>         Hybrid_Provider_Adapter::logout();
>         //$this->adapter->logout();
>     }
> }
>
> /-------------------------------------------------------------------------------------------------------------------/
> the hybrid auth example controller 
>
> <?php
> session_start();
>
> class HaexampleController extends AppController 
> {
>     var $uses = array();
>     var $components = array("hybridAuth");
>     
> public function index() 
>     { 
> } 
>  public function authenticatewith( $provider ) 
>     {   
>         $user_profile = $this->hybridAuth->connect($provider);
>         $this->set('user_profile',$user_profile);  
> }
>     
>     public function logout()
>     {
>         $this->hybridAuth->logout();
>     } 
> }
>
> /-------------------------------------------------------------------------------------------------------------------/
> Any help would be appreciated, Thanks.
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to