dev-master
9999999-devRho Social OAuth 2 Client for Yii 2 Web Applications.
BSD-3-Clause
The Requires
- php >=5.4.0
- yiisoft/yii2 *
- yiisoft/yii2-authclient *
by rhosocial
social extension yii2 client oauth2 rho
Rho Social OAuth 2 Client for Yii 2 Web Applications.
Rho Social OAuth 2 Client for Yii 2 Web Applications. This extension is currently under development. Please do not download, fork or use this extension if you didn't obtained the test invitation, and we temprarily do not accept the pull requests., (*1)
The preferred way to install this extension is through composer., (*2)
Either run, (*3)
php composer.phar require --prefer-dist rhosocial/yii2-oauth2client "*"
or add, (*4)
"rhosocial/yii2-oauth2client": "*"
to the require section of your composer.json
file., (*5)
Attach the Auth Action to Controller:, (*6)
class SiteController extends Controller { public function actions() { return [ 'auth' => [ 'class' => 'rhosocial\Oauth2Client\AuthAction', 'successCallback' => [$this, 'onAuthSuccess'], ], ] } public function onAuthSuccess($client) { $attributes = $client->getUserAttributes(); // user login or signup comes here } }
Attach the following code to the Component
section of main configuration:, (*7)
'authClientCollection' => [ 'class' => 'yii\authclient\Collection', 'clients' => [ 'rho_social' => [ 'class' => 'rhosocial\Oauth2client\Oauth2client', 'clientId' => <client id>, 'clientSecret' => <client secret>, ], ], ],
Please replace the <client id>
and <client secret>
with what assigned for you., (*8)
Then use the AuthChoice Widget in your login view, insert the following code into where you want:, (*9)
<?= yii\authclient\widgets\AuthChoice::widget([ 'baseAuthUrl' => ['site/auth'], 'popupMode' => true, ]);?>
If you didn't choose the 'site/auth' as your Auth Action, please modify the 'baseAuthUrl' property to the actual route., (*10)
If you have any problems or good ideas about yii2-oauth2client, please discuss there, or send an email to opensource@dev.rho.social. Thank you!, (*12)
If you want to send an email with your issues, please briefly introduce yourself first, for instance including your title and github homepage., (*13)
Rho Social OAuth 2 Client for Yii 2 Web Applications.
BSD-3-Clause
social extension yii2 client oauth2 rho