Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

## Fix

- Fix authorization code with Azure OAuth

## [1.5.0] - 2025-09-29

### Added
Expand Down
8 changes: 5 additions & 3 deletions inc/application.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -534,9 +534,11 @@ private static function getProviderScopes(string $provider): array
switch ($provider) {
case Azure::class:
$scopes = [
'openid', 'email', // required to be able to fetch owner details
'offline_access',
'https://outlook.office.com/IMAP.AccessAsUser.All',
'openid', // OpenID Connect authentication
'profile', // Required to get 'preferred_username' claim when 'email' is not available
'email', // Required to get user email address
'offline_access', // Required to get refresh token
'https://outlook.office.com/IMAP.AccessAsUser.All', // IMAP access
];
break;
case Google::class:
Expand Down
9 changes: 4 additions & 5 deletions inc/provider/azure.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,10 @@ public function getOwnerDetails(AccessToken $token): ?OwnerDetails
$owner = $this->getResourceOwner($token);

$owner_details = new OwnerDetails();
if (($email = $owner->claim('email')) !== null) {
$owner_details->email = $email;
} elseif (($upn = $owner->claim('upn')) !== null) {
$owner_details->email = $upn;
}
$owner_details->email =
$owner->claim('email') ??
$owner->claim('upn') ??
$owner->claim('preferred_username');
$owner_details->firstname = $owner->getFirstName();
$owner_details->lastname = $owner->getLastName();

Expand Down
Loading