Closed anek77713 closed 4 years ago
Hi, version 2.0.1 it's not very stable in my opinion, you can use dev-master, I have made it work better.
About your problem, in 2.0.1 the controller it's called "RestController", while in dev-master it's called "DefaultController", so, recheck the url rules in your system to call rest/token/blah instead of default/token/blah. This should work.
I have same problem but changing for "dev-master" was not working,
"require": {
"php": ">=5.4.0",
"yiisoft/yii2": ">=2.0.6",
"yiisoft/yii2-bootstrap": "*",
"yiisoft/yii2-swiftmailer": "*",
"filsh/yii2-oauth2-server": "dev-master"
},
main.php config
'urlManager' => [
'class' => 'yii\web\UrlManager',
'showScriptName' => false,
'enablePrettyUrl' => true,
'rules' => [
'POST oauth2/<action: \w+>' => 'oauth2/default/<action>',
],
],
and module
'modules' => [
'oauth2' => [
'class' => 'filsh\yii2\oauth2server\Module',
'options' => [
'token_param_name' => 'accessToken',
'access_lifetime' => 3600 * 24,
],
'storageMap' => [
'user_credentials' => 'common\models\User',
],
'grantTypes' => [
'user_credentials' => [
'class' => 'OAuth2\GrantType\UserCredentials',
],
'refresh_token' => [
'class' => 'OAuth2\GrantType\RefreshToken',
'always_issue_new_refresh_token' => true
]
]
]
],
Fixed in v2.1.0. Also the master brach now is the current development branch
version 2.0.1 installs - bshaffer/oauth2-server-php (v1.7.1) and in yii2 advanced template I get a 404 error when trying to generate an access token
2015-09-07 13:10:59 [127.0.0.1][-][-][error][yii\web\HttpException:404] exception 'yii\base\InvalidRouteException' with message 'Unable to resolve the request "oauth2/default/token".' in /home/user/project/devel.local/vendor/yiisoft/yii2/base/Module.php:461 Stack trace:
0 /home/user/project/devel.local/vendor/yiisoft/yii2/web/Application.php(84): yii\base\Module->runAction('oauth2/default/...', Array)
1 /home/user/project/devel.local/vendor/yiisoft/yii2/base/Application.php(375): yii\web\Application->handleRequest(Object(yii\web\Request))
2 /home/user/project/devel.local/api/www/index.php(17): yii\base\Application->run()
3 {main}
Next exception 'yii\web\NotFoundHttpException' with message 'Page not found.' in /home/user/project/devel.local/vendor/yiisoft/yii2/web/Application.php:96 Stack trace:
0 /home/user/project/devel.local/vendor/yiisoft/yii2/base/Application.php(375): yii\
my bad composer.json composer config:
everything works fine with composer.json:
When a new stable version is released?