/** * Get the URL to redirect to * * @param string Return URL * @param array Extra parameters * @return string */ public function redirect_url($return_url, array $extra = array()) { // Add the callback URL to the consumer $this->consumer->callback(URL::site($return_url, true)); // Get a request token for the consumer $request_token = $this->provider->request_token($this->consumer); Session::instance()->set('oauth_token', $request_token->token); Session::instance()->set('oauth_token_secret', $request_token->secret); // Redirect to the twitter login page return $this->provider->authorize_url($request_token); }
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 function request_token(OAuth_Consumer $consumer, array $params = NULL) { if (empty($params)) { $params = array(); } $config = Kohana::$config->load('oauth.' . $this->name); if ($scope = Arr::get($config, 'scope')) { $params['scope'] = $scope; } return parent::request_token($consumer, $params); }