Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.3/develop #11

Open
wants to merge 4 commits into
base: 3.2/develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
File renamed without changes.
12 changes: 6 additions & 6 deletions classes/kohana/oauth2.php → classes/Kohana/OAuth2.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
*/
class Kohana_OAuth2 {
// Response Types
const RESPONSE_TYPE_CODE = 'code';
const RESPONSE_TYPE_TOKEN = 'token';
const RESPONSE_TYPE_CODE = 'Code';
const RESPONSE_TYPE_TOKEN = 'Token';

// Grant Types
const GRANT_TYPE_AUTH_CODE = 'authorization_code';
const GRANT_TYPE_PASSWORD = 'password';
const GRANT_TYPE_REFRESH_TOKEN = 'refresh_token';
const GRANT_TYPE_CLIENT_CREDENTIALS = 'client_credentials';
const GRANT_TYPE_AUTH_CODE = 'Authorization_Code';
const GRANT_TYPE_PASSWORD = 'Password';
const GRANT_TYPE_REFRESH_TOKEN = 'Refresh_Token';
const GRANT_TYPE_CLIENT_CREDENTIALS = 'Client_Credentials';

// Token Types
const TOKEN_TYPE_BEARER = 'Bearer';
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,16 @@ public function request_token($grant_type_options = array())
throw new OAuth2_Exception_InvalidGrant('Error! .. '.$response->body());
}

switch ($response->headers('content-type'))
$content_type = explode(';', $response->headers('content-type'));

switch ($content_type[0])
{
case 'application/json':
$x = (array) json_decode($response->body());
break;
case 'application/x-www-form-urlencoded': # Stupid github -_-
parse_str($response->body(), $x);
case 'text/plain': # Stupid facebook -_-
parse_str($response->body(), $x);
break;
default:
throw new OAuth2_Exception_InvalidGrant('Unknown Content-Type: :content_type', array(
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions guide/oauth2/provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Something along the lines of this:
* client. This should be done regardless of if they
* granted permission or not.
*/
$this->request->redirect($redirect_url);
$this->redirect($redirect_url);
}

/**
Expand All @@ -83,7 +83,7 @@ Something along the lines of this:
* logged in, redirect back to this URL ensuring ALL query
* string parameters are included!
*/
$this->request->redirect(Route::url('login'));
$this->redirect(Route::url('login'));
}
}
catch (OAuth2_Exception $e)
Expand Down