Skip to content
Browse files

Starting to fix auth_code consumer grant type..

  • Loading branch information...
1 parent 7f088b5 commit adee2a1ae9af345a203cdd58ef35698bfc4a8538 @kiall kiall committed Sep 9, 2011
View
4 classes/kohana/oauth2/consumer.php
@@ -118,9 +118,9 @@ protected function _execute($request, $token)
return $response;
}
- public function request_token($user_id, $grant_type_options = array())
+ public function request_token($grant_type_options = array())
{
- $this->_grant_type->request_token($user_id, $grant_type_options);
+ $this->_grant_type->request_token($this->_user_id, $grant_type_options);
}
public function get_grant_type()
View
14 classes/kohana/oauth2/consumer/granttype/authorization/code.php
@@ -16,8 +16,11 @@ public function request_token($user_id = NULL, $grant_type_options = array())
$request = Request::factory($this->_config[$this->_provider]['token_uri'])
->method(Request::POST)
->post(array(
- 'grant_type' => 'authorization_code',
- 'code' => $grant_type_options['code'],
+ 'grant_type' => 'authorization_code',
+ 'code' => $grant_type_options['code'],
+ 'redirect_uri' => URL::site($this->_config[$this->_provider]['redirect_uri'], TRUE),
+ 'client_id' => $this->_config[$this->_provider]['client_id'],
+ 'client_secret' => $this->_config[$this->_provider]['client_secret'],
));
$response = $request->execute();
@@ -47,14 +50,15 @@ public function request_token($user_id = NULL, $grant_type_options = array())
return $token;
}
- public function get_redirect_uri($state, $response_type = OAuth2::RESPONSE_TYPE_CODE)
+ public function get_redirect_uri($state = NULL, $response_type = OAuth2::RESPONSE_TYPE_CODE)
{
$query = http_build_query(array(
'client_id' => $this->_config[$this->_provider]['client_id'],
- 'redirect_uri' => $this->_config[$this->_provider]['redirect_uri'],
+ 'redirect_uri' => URL::site($this->_config[$this->_provider]['redirect_uri'], TRUE),
'response_type' => $response_type,
+ 'state' => $state
));
- return $this->_config[$this->_provider]['redirect_uri'].'?'.$query;
+ return $this->_config[$this->_provider]['authorize_uri'].'?'.$query;
}
}

0 comments on commit adee2a1

Please sign in to comment.
Something went wrong with that request. Please try again.