Exemplo n.º 1
0
	public function before()
	{
		parent::before();

		// The user is already logged in
		if (Auth::instance()->logged_in())
		{
			Request::instance()->redirect('');
		}

		// Load the configuration for this provider
		$config = Kohana::config('oauth.'.$this->provider);

		// Create a consumer from the config
		$this->consumer = OAuth_Consumer::factory($config);

		// Load the provider
		$this->provider = OAuth_Provider::factory($this->provider);

		if ($token = Cookie::get($this->cookie))
		{
			// Get the token from storage
			$this->token = unserialize($token);
		}
	}
Exemplo n.º 2
0
 public function __construct($provider)
 {
     $this->provider_name = $provider;
     // Load the configuration for this provider
     $config = Kohana::$config->load('oauth.' . $this->provider_name);
     // Create an consumer from the config
     $this->consumer = OAuth_Consumer::factory($config);
     // Load the provider
     $this->provider = OAuth_Provider::factory($this->provider_name);
 }
Exemplo n.º 3
0
Arquivo: oauth.php Projeto: rafi/oauth
 public function before()
 {
     parent::before();
     // Load the cookie session
     $this->session = Session::instance('cookie');
     // Get the name of the demo from the class name
     $provider = strtolower($this->api);
     // Load the provider
     $this->provider = OAuth_Provider::factory($provider);
     // Load the consumer
     $this->consumer = OAuth_Consumer::factory(Kohana::config("oauth.{$provider}"));
     if ($token = $this->session->get($this->key('access'))) {
         // Make the access token available
         $this->token = $token;
     }
 }
Exemplo n.º 4
0
 public function oauth_init($provider = 'twitter')
 {
     $this->provider = $provider;
     // Load the configuration for this provider
     $config = Kohana::config('oauth.' . $this->provider);
     // Create a consumer from the config
     $this->consumer = OAuth_Consumer::factory($config);
     // Load the provider
     $this->provider = OAuth_Provider::factory($this->provider);
     if ($token = Cookie::get($this->cookie)) {
         // Get the token from storage
         $this->token = unserialize($token);
     }
 }