-
Notifications
You must be signed in to change notification settings - Fork 45
Open
Description
to save some time of others, as the current repo is abandoned, these repos (updated branches) seem to be up-to-date:
- https://github.com/Trunkstar/oauth2-microsoft but if you want to allow other audiance, you should override & replace
/organizationswith/commonor/consumersfor your in below example:
$provider = new Trunkstar\OAuth2\Client\Provider\Microsoft([
...
'urlAuthorize'=>'https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize',
'urlAccessToken'=>'https://login.microsoftonline.com/organizations/oauth2/v2.0/token',
]);
or
i have added those 2 modified files from: https://github.com/oddhill/oauth2-microsoft/tree/support-org-mail/src/Provider
and example use:
$provider = new Stevenmaguire\OAuth2\Client\Provider\Microsoft([
'clientId' => 'xxx',
'clientSecret' => 'xxx',
'redirectUri' => 'xxx',
]);
if (isset($_GET['error'])) {
var_dump($_REQUEST);
exit;
}
if (!isset($_GET['code'])) {
// If we don't have an authorization code then get one
$options = [
'state' => 'OPTIONAL_CUSTOM_CONFIGURED_STATE',
'scope' => ['User.Read'] // array or string
];
$authUrl = $provider->getAuthorizationUrl($options);
// $this->setcookie ('ms_oauth2state', $provider->getState() );
header('Location: ' . $authUrl);
exit;
}
....
TeadleLoicTeadleLoicTeadleLoic
Metadata
Metadata
Assignees
Labels
No labels