php7安装oauth2扩展,php – Yii2 – Filsh OAuth2服务器安装

Satya是对的.您需要按照

repo’s description中的描述配置oauth2模块:

‘oauth2’ => [

‘class’ => ‘filsh\yii2\oauth2server\Module’,

‘options’ => [

‘token_param_name’ => ‘accessToken’,

‘access_lifetime’ => 3600 * 24

],

‘storageMap’ => [

‘user_credentials’ => ‘common\models\User’

],

‘grantTypes’ => [

‘client_credentials’ => [

‘class’ => ‘OAuth2\GrantType\ClientCredentials’,

‘allow_public_clients’ => false

],

‘user_credentials’ => [

‘class’ => ‘OAuth2\GrantType\UserCredentials’

],

‘refresh_token’ => [

‘class’ => ‘OAuth2\GrantType\RefreshToken’,

‘always_issue_new_refresh_token’ => true

]

],

]

我已成功配置此扩展,并使用OAuth2服务器https://github.com/ikaras/yii2-oauth2-rest-template创建了Yii2 Rest API模板 – 随意使用.此代码还有一些演示数据(使用示例)和控制器范围的支持.