pde159/yii2-authclient-microsoft

Microsoft 365/Azure 认证提供者

0.0.2 2020-07-27 14:04 UTC

This package is auto-updated.

Last update: 2024-09-27 23:22:43 UTC


README

Yii2 Microsoft 365/Azure 认证客户端

安装

使用 Composer

composer require pde159/yii2-authclient-microsoft

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

"pde159/yii2-authclient-microsoft": "*"

使用方法

首先通过 Microsoft Azure Portal 创建您的应用程序并配置

  • 重定向 URI
  • 密钥
  • 设置为 所有租户 以实现多租户可用性

并将 OAuth2 客户端添加到您的 Yii2 配置的 component 部分

'components' => [
    'authClientCollection' => [
        'class'   => \yii\authclient\Collection::className(),
        'clients' => [
            'microsoft' => [
                'class'         => 'pde159\authclient\Microsoft',
                'returnUrl'     => 'https:///user/login',
                'clientId'      => 'clientIDyoudefinedInAzurePortal',
                'clientSecret'  => 'SecretyoucratedinAzurePortal',
            ],
            ...
        ],
    ],
    ...
]