OAuth_Provider_Google
Kohana_OAuth_Provider_Google
OAuth_Provider
Kohana_OAuth_Provider

Class Contents

Class declared in MODPATH/oauth/classes/oauth/provider/google.php on line 3.

Properties

public $name

Methods

public request_token( )
Kohana_OAuth_Provider_Google

Source Code
public function request_token(OAuth_Consumer $consumer, array $params = NULL)
{
	if ( ! isset($params['scope']))
	{
		// All request tokens must specify the data scope to access
		// http://code.google.com/apis/accounts/docs/OAuth.html#prepScope
		throw new Kohana_OAuth_Exception('Required parameter to not passed: :param', array(
			':param' => 'scope',
		));
	}

	return parent::request_token($consumer, $params);
}

public url_access_token( )
Kohana_OAuth_Provider_Google

Source Code
public function url_access_token()
{
	return 'https://www.google.com/accounts/OAuthGetAccessToken';
}

public url_authorize( )
Kohana_OAuth_Provider_Google

Source Code
public function url_authorize()
{
	return 'https://www.google.com/accounts/OAuthAuthorizeToken';
}

public url_request_token( )
Kohana_OAuth_Provider_Google

Source Code
public function url_request_token()
{
	return 'https://www.google.com/accounts/OAuthGetRequestToken';
}

public __construct( )
Kohana_OAuth_Provider

Source Code
public function __construct(array $options = NULL)
{
	if (isset($options['signature']))
	{
		// Set the signature method name or object
		$this->signature = $options['signature'];
	}

	if ( ! is_object($this->signature))
	{
		// Convert the signature name into an object
		$this->signature = OAuth_Signature::factory($this->signature);
	}

	if ( ! $this->name)
	{
		// Attempt to guess the name from the class name
		$this->name = strtolower(substr(get_class($this), strlen('OAuth_Provider_')));
	}
}

public __get( )
Kohana_OAuth_Provider

Source Code
public function __get($key)
{
	return $this->$key;
}

public access_token( )
Kohana_OAuth_Provider

Source Code
public function access_token(OAuth_Consumer $consumer, OAuth_Token_Request $token, array $params = NULL)
{
	// Create a new GET request for a request token with the required parameters
	$request = OAuth_Request::factory('access', 'GET', $this->url_access_token(), array(
		'oauth_consumer_key' => $consumer->key,
		'oauth_token'        => $token->token,
		'oauth_verifier'     => $token->verifier,
	));

	if ($params)
	{
		// Load user parameters
		$request->params($params);
	}

	// Sign the request using only the consumer, no token is available yet
	$request->sign($this->signature, $consumer, $token);

	// Create a response from the request
	$response = $request->execute();

	// Store this token somewhere useful
	return OAuth_Token::factory('access', array(
		'token'  => $response->param('oauth_token'),
		'secret' => $response->param('oauth_token_secret'),
	));
}

public authorize_url( )
Kohana_OAuth_Provider

Source Code
public function authorize_url(OAuth_Token_Request $token, array $params = NULL)
{
	// Create a new GET request for a request token with the required parameters
	$request = OAuth_Request::factory('authorize', 'GET', $this->url_authorize(), array(
		'oauth_token' => $token->token,
	));

	if ($params)
	{
		// Load user parameters
		$request->params($params);
	}

	return $request->as_url();
}

public static factory( )
Kohana_OAuth_Provider

Source Code
public static function factory($name, array $options = NULL)
{
	$class = 'OAuth_Provider_'.$name;

	return new $class($options);
}