Comments (4)
Replace in config:
'options' => [
'token_param_name' => 'accessToken',
'access_lifetime' => 3600 * 24
],
with
'tokenParamName' => 'accessToken',
'tokenAccessLifetime' => 3600 * 24,
from yii2-oauth2-server.
Hi,
I am posting this via postman
POST http://localhost:8085/oauth2/token
{"grant_type":"password","username":"[email protected]","password":"123","client_id":"testclient","client_secret":"testpass"}
and get following exception
Unknown Property – yii\base\UnknownPropertyException
Setting unknown property: filsh\yii2\oauth2server\Module::tokenParamName
- in C:\Data\yii\yii2-advanced-api\vendor\yiisoft\yii2\base\Component.php\n \n at line 197
$behavior->$name = $value;\n \n return;\n } } } if (method_exists($this, 'get' . $name)) { throw new InvalidCallException('Setting read-only property: ' . get_class($this) . '::' . $name);\n } else { throw new UnknownPropertyException('Setting unknown property: ' . get_class($this) . '::' . $name); } - in C:\Data\yii\yii2-advanced-api\vendor\yiisoft\yii2\BaseYii.php\n \n at line 518
yii\base\Component::__set('tokenParamName', 'accessToken') - in C:\Data\yii\yii2-advanced-api\vendor\yiisoft\yii2\base\Object.php\n \n at line 105 yii\BaseYii::configure(filsh\yii2\oauth2server\Module, ['tokenParamName' => 'accessToken', 'tokenAccessLifetime' => 86400, 'storageMap' => ['user_credentials' => 'api\models\User'], 'grantTypes' => ['user_credentials' => ['class' => 'OAuth2\GrantType\UserCredentials'], 'refresh_token' => ['class' => 'OAuth2\GrantType\RefreshToken', 'always_issue_new_refresh_token' => true]]])
- in C:\Data\yii\yii2-advanced-api\vendor\yiisoft\yii2\base\Module.php\n \n at line 138 yii\base\Object::__construct(['tokenParamName' => 'accessToken', 'tokenAccessLifetime' => 86400, 'storageMap' => ['user_credentials' => 'api\models\User'], 'grantTypes' => ['user_credentials' => ['class' => 'OAuth2\GrantType\UserCredentials'], 'refresh_token' => ['class' => 'OAuth2\GrantType\RefreshToken', 'always_issue_new_refresh_token' => true]]])
- yii\base\Module::__construct('oauth2', yii\web\Application, ['tokenParamName' => 'accessToken', 'tokenAccessLifetime' => 86400, 'storageMap' => ['user_credentials' => 'api\models\User'], 'grantTypes' => ['user_credentials' => ['class' => 'OAuth2\GrantType\UserCredentials'], 'refresh_token' => ['class' => 'OAuth2\GrantType\RefreshToken', 'always_issue_new_refresh_token' => true]]])
- in C:\Data\yii\yii2-advanced-api\vendor\yiisoft\yii2\di\Container.php\n \n at line 372 ReflectionClass::newInstanceArgs(['oauth2', yii\web\Application, ['tokenParamName' => 'accessToken', 'tokenAccessLifetime' => 86400, 'storageMap' => ['user_credentials' => 'api\models\User'], 'grantTypes' => ['user_credentials' => ['class' => 'OAuth2\GrantType\UserCredentials'], 'refresh_token' => ['class' => 'OAuth2\GrantType\RefreshToken', 'always_issue_new_refresh_token' => true]]]])
- in C:\Data\yii\yii2-advanced-api\vendor\yiisoft\yii2\di\Container.php\n \n at line 151
yii\di\Container::build('filsh\yii2\oauth2server\Module', ['oauth2', yii\web\Application], ['tokenParamName' => 'accessToken', 'tokenAccessLifetime' => 86400, 'storageMap' => ['user_credentials' => 'api\models\User'], 'grantTypes' => ['user_credentials' => ['class' => 'OAuth2\GrantType\UserCredentials'], 'refresh_token' => ['class' => 'OAuth2\GrantType\RefreshToken', 'always_issue_new_refresh_token' => true]]]) - in C:\Data\yii\yii2-advanced-api\vendor\yiisoft\yii2\BaseYii.php\n \n at line 344
yii\di\Container::get('filsh\yii2\oauth2server\Module', ['oauth2', yii\web\Application], ['tokenParamName' => 'accessToken', 'tokenAccessLifetime' => 86400, 'storageMap' => ['user_credentials' => 'api\models\User'], 'grantTypes' => ['user_credentials' => ['class' => 'OAuth2\GrantType\UserCredentials'], 'refresh_token' => ['class' => 'OAuth2\GrantType\RefreshToken', 'always_issue_new_refresh_token' => true]]]) - in C:\Data\yii\yii2-advanced-api\vendor\yiisoft\yii2\base\Module.php\n \n at line 354
yii\BaseYii::createObject(['class' => 'filsh\yii2\oauth2server\Module', 'tokenParamName' => 'accessToken', 'tokenAccessLifetime' => 86400, 'storageMap' => ['user_credentials' => 'api\models\User'], ...], ['oauth2', yii\web\Application]) - in C:\Data\yii\yii2-advanced-api\vendor\yiisoft\yii2\base\Module.php\n \n at line 511 yii\base\Module::getModule('oauth2')
- in C:\Data\yii\yii2-advanced-api\vendor\yiisoft\yii2\base\Module.php\n \n at line 449 yii\base\Module::createController('oauth2/default/token')
- in C:\Data\yii\yii2-advanced-api\vendor\yiisoft\yii2\web\Application.php\n \n at line 84 yii\base\Module::runAction('oauth2/default/token', [])
config module is set up as follows :
'oauth2' => [
'class' => 'filsh\yii2\oauth2server\Module',
'tokenParamName' => 'accessToken',
'tokenAccessLifetime' => 3600 * 24,
'storageMap' => [
'user_credentials' => 'api\models\User',
]
Any pointers?
Thanks
from yii2-oauth2-server.
Did a composer update to get yii2-oauth2-server 2.0.0 and bshaffer/oauth2-server-php ~1.7.1. I still had to get latest Module.php, Server.php, Request.php & Response.php files as these were not included in the update. This solved the problem
from yii2-oauth2-server.
from yii2-oauth2-server.
Related Issues (20)
- Is this project still live? HOT 3
- yii 2.0.13 has erros!~ HOT 7
- Authorization url
- 不能使用授权码认证(AuthorizationCode) HOT 1
- oauth2/token 使用最新的yii2版本,访问报错 HOT 1
- Module.php getRequest() function has an error after yii 2.0.13 HOT 5
- How to install and run HOT 6
- where is a example? HOT 1
- Add 'auth_code_lifetime' support to config HOT 1
- Declaration of m140501_075311_add_oauth2_server::primaryKey($columns) should be compatible with yii\db\Migration::primaryKey($length = NULL) HOT 2
- document error for migration HOT 1
- Calling unknown method: filsh\yii2\oauth2server\Module::handleAuthorizeRequest() HOT 2
- How to use scopes?
- How to add own field in login responce? HOT 1
- Not able to generate token getting handleAuthorizeRequest error HOT 4
- Invalid credentials
- Need more example with Yii2 Auth client integration
- How to use this extension with official Yii2 AuthClient ? HOT 1
- How to implement OpenID Connect ?
- ASK, how to get the public key to show to specific url HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yii2-oauth2-server.