wangrunxinyes/yii2-wrx-oauth2-client

Yii2 OAuth Client For wangrunxin.com.

dev-master 2019-10-24 08:13 UTC

This package is auto-updated.

Last update: 2024-03-29 03:50:29 UTC


README

A wrapper for implementing an OAuth2 Server(https://www.wangrunxin.com)

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist wangrunxinyes/yii2-wrx-oauth2-client "*"

or add

"wangrunxinyes/yii2-wrx-oauth2-client": "*"

to the require section of your composer.json.

To use this extension, simply add the following code in your application configuration as a new module:

'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' => '',
                    ],
                ],
            ],
        ],
],

The next step your shold run migration

yii migrate --migrationPath=@vendor/wangrunxinyes/yii2-wrx-oauth2-client/migrations

For more, see https://www.wangrunxin.com/oauth.js