wangrunxinyes / yii2-wrx-oauth2-client
为 wangrunxin.com 设计的 Yii2 OAuth 客户端。
dev-master
2019-10-24 08:13 UTC
Requires
- php: >=5.4
- defuse/php-encryption: *
- yiisoft/yii2: >=2.0.6@stable
- yiisoft/yii2-authclient: ~2.0
This package is auto-updated.
Last update: 2024-09-29 05:09:12 UTC
README
OAuth2 服务器实现包装器(https://www.wangrunxin.com)
安装
安装此扩展的首选方式是通过 composer。
运行以下命令之一
php composer.phar require --prefer-dist wangrunxinyes/yii2-wrx-oauth2-client "*"
或者在 composer.json 的 require 部分添加
"wangrunxinyes/yii2-wrx-oauth2-client": "*"
到
要使用此扩展,只需在应用程序配置中添加以下代码作为一个新的模块
'modules'=>[ //other modules ..... 'wrx' => [ 'class' => 'wangrunxinyes\OAuth\Module', 'controllerMap' => [ //Overwrite OauthController and handle AuthSccuess for your own project; //Your OauthController should extend wangrunxinyes\OAuth\controllers\OauthController. 'oauth' => 'Your own OauthController className', ], 'mixKey' => 'Your random code', ], ], 'components' => [ //other components ..... 'authClientCollection' => [ 'class' => yii\authclient\Collection::class, 'clients' => [ 'wrxauth' => [ 'class' => wangrunxinyes\OAuth\models\Client::class, 'clientId' => 'Your client_id', 'clientSecret' => 'Your client_secret', 'scope' => '', ], ], ], ], ],
下一步您应该运行迁移
yii migrate --migrationPath=@vendor/wangrunxinyes/yii2-wrx-oauth2-client/migrations
更多内容,请参阅 https://www.wangrunxin.com/oauth.js