macfly / yii2-authclient-oauth2

该包已弃用,不再维护。未建议替代包。

yii2-oauth2-server的OAuth2客户端

0.0.1 2017-02-28 15:46 UTC

This package is auto-updated.

Last update: 2023-04-13 03:41:20 UTC


README

Yii2认证客户端Oauth 2.0 Server Phpmacfly/yii2-oauth2-server配合使用良好

安装

通过控制台Composer进行安装

composer require macfly/yii2-authclient-oauth2

或添加到composer.json的"require"部分

"macfly/yii2-authclient-oauth2": "*"

##用法

设置您的OAuth2服务器,您可以查看(https://github.com/Marty-Macfly/yii2-oauth2-server)并将OAuth2客户端添加到您的认证客户端。

php
'components' => [
    'authClientCollection' => [
      'class'   => \yii\authclient\Collection::className(),
      'clients' => [
        'oauth2-server-php' => [
          'class'             => 'macfly\authclient\OAuth2',
          'authUrl'         => 'http://193.168.5.1:8889/oauth2/authorize',
          'tokenUrl'        => 'http://193.168.5.1:8889/oauth2/token',
          'apiBaseUrl'      => 'http://193.168.5.1:8889/oauth2',
#         'returnUrl'       => 'http://127.0.0.1:8888/user/security/auth?authclient=oauth2',
          'clientId'        => 'testclient',
          'clientSecret'    => 'testpass',
        ],
        // other clients
      ],
    ],
    // ...
 ]