Skip to content

Loading…

Fix undefined client_secret bug #21

Open
wants to merge 2 commits into from

1 participant

@luissquall

Return null when client_secret is not set. The notice was: Undefined index: client_secret [APP/Vendor/oauth2-php/lib/OAuth2.php, line 776]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 14, 2012
  1. @luissquall
Commits on Jul 19, 2012
  1. @luissquall

    Check client_secret is set

    luissquall committed
Showing with 2 additions and 1 deletion.
  1. +1 −1 lib/OAuth2.php
  2. +1 −0 lib/OAuth2AuthenticateException.php
View
2 lib/OAuth2.php
@@ -773,7 +773,7 @@ protected function getClientCredentials(array $inputData, array $authHeaders) {
throw new OAuth2ServerException(self::HTTP_BAD_REQUEST, self::ERROR_INVALID_CLIENT, 'Client id was not found in the headers or body');
} else {
// This method is not recommended, but is supported by specification
- return array($inputData['client_id'], $inputData['client_secret']);
+ return array($inputData['client_id'], isset($inputData['client_secret']) ? $inputData['client_secret'] : null);
}
}
View
1 lib/OAuth2AuthenticateException.php
@@ -50,6 +50,7 @@ public function __construct($httpCode, $tokenType, $realm, $error, $error_descri
* @ingroup oauth2_section_5
*/
protected function sendHeaders() {
+ parent::sendHeaders();
header($this->header);
}
}
Something went wrong with that request. Please try again.