istvan0304/yii2-office365-oauth
最新稳定版本:2.1.0
Composer 安装命令:
composer require istvan0304/yii2-office365-oauth
包简介
Office 365 login for yii2 app
README 文档
README
Requirements
- php >=7.2
Installation
The preferred way to install this extension is through composer.
-
Run
$ php composer.phar require istvan0304/yii2-office365-oauth "dev-master"
or add:
"istvan0304/yii2-office365-oauth": "dev-master"
to the require section of your application's composer.json file.
Usage
-
In controller apply:
public function actions() { return [ 'o365auth' => [ 'class' => 'cranedev\authclientO365\Office365AuthAction', 'successCallback' => [$this, 'onAuthSuccess'], ], ]; } public function onAuthSuccess($client) { // Handle login... } -
In view:
<?= AuthChoice::widget([ 'baseAuthUrl' => ['site/o365auth'], 'popupMode' => false, ]) ?>OR create a link
-
Set Environment variables
-
Setup http client
return [ 'components' => [ 'authClientCollection' => [ 'class' => 'yii\authclient\Collection', 'clients' => [ 'o365' => [ 'class' => 'istvan0304\yii2office365oauth\src\Office365OAuth', 'clientId' => getenv('AUTH_CLIENT_ID'), 'clientSecret' => getenv('AUTH_CLIENT_SECRET'), 'authUrl' => getenv('AUTH_URL'), 'tokenUrl' => getenv('AUTH_TOKEN_URL'), 'apiBaseUrl' => getenv('GRAPH_URL'), 'returnUrl' => getenv('AUTH_RETURN_URL'), 'scope' => getenv('AUTH_SCOPE'), 'resource' => getenv('AUTH_RESOURCE_URL'), 'title' => 'Title', // 'login_hint' => '', 'selectParams' => 'id,displayName,userPrincipalName,mail,photo,mobilePhone,preferredLanguage,onPremisesExtensionAttributes', //'proxy' => getenv('AUTH_PROXY_URL'), ], ], //... ], // ... ];
-
统计信息
- 总下载量: 424
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-04-25