Yii2 authclient for Microsoft 365/Azure
With Composer :
composer require pde159/yii2-authclient-microsoft
or add to "require" section to composer.json
"pde159/yii2-authclient-microsoft": "*"
First create you Application via Microsoft Azure Portal and configure :
- a redirect URI
- a secret key
- set to
all tenant
for multitenant availability
And add the Oauth2 client to your Yii2 configuration component
section
'components' => [
'authClientCollection' => [
'class' => \yii\authclient\Collection::className(),
'clients' => [
'microsoft' => [
'class' => 'pde159\authclient\Microsoft',
'returnUrl' => 'http://localhost/user/login',
'clientId' => 'clientIDyoudefinedInAzurePortal',
'clientSecret' => 'SecretyoucratedinAzurePortal',
],
...
],
],
...
]