Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 00c255e

Browse files
committed
fixing token checking
1 parent ad676f2 commit 00c255e

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

lib/OAuth2.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -841,18 +841,16 @@ public function getAuthorizeParams(array $inputData = NULL) {
841841

842842
// Select the redirect URI
843843
$input["redirect_uri"] = isset($input["redirect_uri"]) ? $input["redirect_uri"] : $stored["redirect_uri"];
844-
844+
845845
// type and client_id are required
846846
if (!$input["response_type"]) {
847847
throw new OAuth2RedirectException($input["redirect_uri"], self::ERROR_INVALID_REQUEST, 'Invalid or missing response type.', $input["state"]);
848848
}
849-
850-
// Check requested auth response type against interfaces of storage engine
851-
$reflect = new ReflectionClass($this->storage);
852-
if (!$reflect->hasConstant('RESPONSE_TYPE_' . strtoupper($input['response_type']))) {
849+
850+
if ($input['response_type'] != self::RESPONSE_TYPE_AUTH_CODE && $input['response_type'] != self::RESPONSE_TYPE_ACCESS_TOKEN) {
853851
throw new OAuth2RedirectException($input["redirect_uri"], self::ERROR_UNSUPPORTED_RESPONSE_TYPE, NULL, $input["state"]);
854852
}
855-
853+
856854
// Validate that the requested scope is supported
857855
if ($input["scope"] && !$this->checkScope($input["scope"], $this->getVariable(self::CONFIG_SUPPORTED_SCOPES))) {
858856
throw new OAuth2RedirectException($input["redirect_uri"], self::ERROR_INVALID_SCOPE, 'An unsupported scope was requested.', $input["state"]);

0 commit comments

Comments
 (0)