diff --git a/includes/integrations/microsoft.php b/includes/integrations/microsoft.php index f45992d..dea416c 100644 --- a/includes/integrations/microsoft.php +++ b/includes/integrations/microsoft.php @@ -10,7 +10,7 @@ require_once __DIR__ . '/../../config/database.php'; const MS_OAUTH_AUTHORIZE_URL = 'https://login.microsoftonline.com/%s/oauth2/v2.0/authorize'; const MS_OAUTH_TOKEN_URL = 'https://login.microsoftonline.com/%s/oauth2/v2.0/token'; const MS_GRAPH_BASE_URL = 'https://graph.microsoft.com/v1.0'; -const MS_DEFAULT_SCOPES = 'offline_access openid profile email User.Read Calendars.Read'; +const MS_DEFAULT_SCOPES = 'offline_access User.Read Calendars.ReadWrite'; /** * Genereert de Microsoft OAuth2 login URL diff --git a/integrations.php b/integrations.php index 551efb4..d809995 100644 --- a/integrations.php +++ b/integrations.php @@ -309,13 +309,13 @@ $redirectUri = rtrim(APP_URL, '/') . '/auth/callback_microsoft.php';

4. Maak een geheim aan onder Certificaten en geheimen.

-

5. Voeg API-machtigingen toe: Calendars.Read, User.Read, offline_access.

+

5. Voeg API-machtigingen toe: Calendars.ReadWrite, User.Read, offline_access.

6. Cruciaal voor organisaties: Klik direct boven de tabel met machtigingen op de knop "Beheerdersgoedkeuring verlenen voor [Organisatie]" (Grant admin consent) en bevestig met 'Ja'. Hiermee voorkomt u de melding "Beheerdersgoedkeuring vereist".

@@ -390,16 +390,25 @@ $redirectUri = rtrim(APP_URL, '/') . '/auth/callback_microsoft.php'; $curClientId = !empty($outlookSettings['client_id']) ? $outlookSettings['client_id'] : fociz_env('MICROSOFT_CLIENT_ID', ''); $curTenantId = !empty($outlookSettings['tenant_id']) ? $outlookSettings['tenant_id'] : 'organizations'; if (!empty($curClientId)): - $adminConsentUrl = "https://login.microsoftonline.com/" . urlencode($curTenantId) . "/adminconsent?client_id=" . urlencode($curClientId) . "&redirect_uri=" . urlencode($redirectUri); + $adminConsentUrl = "https://login.microsoftonline.com/" . urlencode($curTenantId) . "/v2.0/adminconsent?client_id=" . urlencode($curClientId) . "&redirect_uri=" . urlencode($redirectUri) . "&scope=" . urlencode("https://graph.microsoft.com/.default"); ?>
-