Closed seakk closed 6 years ago
Same problem that i also encountered
Those errors are coming from that change in 2.0.13 :
Behavior was changed for methods yii\base\Module::get() and yii\base\Module::has() so in case when the requested component was not found in the current module, the parent ones will be checked for this component hierarchically. Considering that the root parent module is usually an application, this change can reduce calls to global Yii::$app->get(), and replace them with module-scope calls to get(), making code more reliable and easier to test. However, this change may affect your application if you have code that uses method yii\base\Module::has() in order to check existence of the component exactly in this specific module. In this case make sure the logic is not corrupted.
I've fixed it with the following code: https://github.com/Filsh/yii2-oauth2-server/compare/e05fff97252f9e067cf0eae276ea36e9e87ae3e2...Marty-Macfly:2.0.2?diff=unified&name=2.0.2
@Marty-Macfly thanks!
@Filsh I hope you can fix this bug in the next version
@marty-macfly thank you. If someone need it, i merged 2.0.1 branch with this Yii 2.0.13 fixes in my fork https://github.com/cheeseq/yii2-oauth2-server
This might be related to this other issue: https://github.com/Filsh/yii2-oauth2-server/issues/132 Another user posted a fix there which worked for me.
create acess_token: { "name": "PHP Recoverable Error", "message": "Argument 1 passed to OAuth2\Server::handleTokenRequest() must be an instance of OAuth2\RequestInterface, instance of yii\web\Request given, called in /WebServer/yii2/yiishop/vendor/filsh/yii2-oauth2-server/Server.php on line 39 and defined", "code": 4096, "type": "yii\base\ErrorException", "file": "/WebServer/yii2/yiishop/vendor/bshaffer/oauth2-server-php/src/OAuth2/Server.php", "line": 298, "stack-trace": [ "#0 /WebServer/yii2/yiishop/vendor/bshaffer/oauth2-server-php/src/OAuth2/Server.php(298): yii\base\ErrorHandler->handleError(4096, 'Argument 1 pass...', '/WebServer/yii2...', 298, Array)", "#1 /WebServer/yii2/yiishop/vendor/filsh/yii2-oauth2-server/Server.php(39): OAuth2\Server->handleTokenRequest(Object(yii\web\Request), NULL)", "#2 /WebServer/yii2/yiishop/vendor/filsh/yii2-oauth2-server/controllers/RestController.php(25): filsh\yii2\oauth2server\Server->handleTokenRequest()", "#3 [internal function]: filsh\yii2\oauth2server\controllers\RestController->actionToken()", "#4 /WebServer/yii2/yiishop/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)", "#5 /WebServer/yii2/yiishop/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)", "#6 /WebServer/yii2/yiishop/vendor/yiisoft/yii2/base/Module.php(528): yii\base\Controller->runAction('token', Array)", "#7 /WebServer/yii2/yiishop/vendor/yiisoft/yii2/web/Application.php(103): yii\base\Module->runAction('oauth2/rest/tok...', Array)", "#8 /WebServer/yii2/yiishop/vendor/yiisoft/yii2/base/Application.php(386): yii\web\Application->handleRequest(Object(yii\web\Request))", "#9 /WebServer/yii2/yiishop/api/web/index.php(17): yii\base\Application->run()", "#10 {main}" ] }
verify acess_token: { "name": "PHP Recoverable Error", "message": "Argument 1 passed to OAuth2\Server::verifyResourceRequest() must be an instance of OAuth2\RequestInterface, instance of yii\web\Request given, called in /WebServer/yii2/yiishop/vendor/filsh/yii2-oauth2-server/Server.php on line 31 and defined", "code": 4096, "type": "yii\base\ErrorException", "file": "/WebServer/yii2/yiishop/vendor/bshaffer/oauth2-server-php/src/OAuth2/Server.php", "line": 398, "stack-trace": [ "#0 /WebServer/yii2/yiishop/vendor/bshaffer/oauth2-server-php/src/OAuth2/Server.php(398): yii\base\ErrorHandler->handleError(4096, 'Argument 1 pass...', '/WebServer/yii2...', 398, Array)", "#1 /WebServer/yii2/yiishop/vendor/filsh/yii2-oauth2-server/Server.php(31): OAuth2\Server->verifyResourceRequest(Object(yii\web\Request), NULL, NULL)", "#2 /WebServer/yii2/yiishop/vendor/filsh/yii2-oauth2-server/filters/auth/CompositeAuth.php(15): filsh\yii2\oauth2server\Server->verifyResourceRequest()", "#3 /WebServer/yii2/yiishop/vendor/yiisoft/yii2/base/ActionFilter.php(75): filsh\yii2\oauth2server\filters\auth\CompositeAuth->beforeAction(Object(yii\base\InlineAction))", "#4 [internal function]: yii\base\ActionFilter->beforeFilter(Object(yii\base\ActionEvent))", "#5 /WebServer/yii2/yiishop/vendor/yiisoft/yii2/base/Component.php(557): call_user_func(Array, Object(yii\base\ActionEvent))", "#6 /WebServer/yii2/yiishop/vendor/yiisoft/yii2/base/Controller.php(274): yii\base\Component->trigger('beforeAction', Object(yii\base\ActionEvent))", "#7 /WebServer/yii2/yiishop/vendor/yiisoft/yii2/web/Controller.php(164): yii\base\Controller->beforeAction(Object(yii\base\InlineAction))", "#8 /WebServer/yii2/yiishop/vendor/yiisoft/yii2/base/Controller.php(155): yii\web\Controller->beforeAction(Object(yii\base\InlineAction))", "#9 /WebServer/yii2/yiishop/vendor/yiisoft/yii2/base/Module.php(528): yii\base\Controller->runAction('list', Array)", "#10 /WebServer/yii2/yiishop/vendor/yiisoft/yii2/web/Application.php(103): yii\base\Module->runAction('study/test/list', Array)", "#11 /WebServer/yii2/yiishop/vendor/yiisoft/yii2/base/Application.php(386): yii\web\Application->handleRequest(Object(yii\web\Request))", "#12 /WebServer/yii2/yiishop/api/web/index.php(17): yii\base\Application->run()", "#13 {main}" ] }