krupni / yii-eoauth
Yii框架扩展。EOAuthUserIdentity类实现了IUserIdentity Yii接口和OAuth协议,用于用户身份验证。基于Google的软件。
1.0.0
2018-05-24 13:34 UTC
This package is not auto-updated.
Last update: 2024-09-21 19:09:59 UTC
README
此仓库已恢复itmages/yii-eoauth
安装包
composer require krupni/yii-eoauth
简介
EOAuthUserIdentity类实现了IUserIdentity Yii接口和OAuth协议来验证用户。
基于Google的软件。
###资源
##文档
###要求
- Yii 1.0或更高版本
###安装
- 在
protected/extensions/eoauth
下解压发布文件
###使用
使用此示例动作进行Google的登录/登出
public function actionLogin() { Yii::import('ext.eoauth.*'); $ui = new EOAuthUserIdentity( array( //Set the "scope" to the service you want to use 'scope'=>'https://sandbox.google.com/apis/ads/publisher/', 'provider'=>array( 'request'=>'https://www.google.com/accounts/OAuthGetRequestToken', 'authorize'=>'https://www.google.com/accounts/OAuthAuthorizeToken', 'access'=>'https://www.google.com/accounts/OAuthGetAccessToken', ) ) ); if ($ui->authenticate()) { $user=Yii::app()->user; $user->login($ui); $this->redirect($user->returnUrl); } else throw new CHttpException(401, $ui->error); } public function actionLogout() { Yii::app()->user->logout(); // Redirect to application home page. $this->redirect(Yii::app()->homeUrl); }
在main.php中设置加载扩展(由DavidHHuan提供,谢谢!)
'import'=>array( 'application.models.*', 'application.components.*', 'ext.eoauth.*', 'ext.eoauth.lib.*', ),
许可
之前我为InDaHouseRulez SL开发了此扩展。我现在不再那里工作了,但我仍然支持此扩展。