diff --git a/lib/services/caldav-sync.ts b/lib/services/caldav-sync.ts index 27708e3..01ad4db 100644 --- a/lib/services/caldav-sync.ts +++ b/lib/services/caldav-sync.ts @@ -98,9 +98,17 @@ export async function discoverInfomaniakCalendars( return calendars; } catch (error) { + const errorMessage = error instanceof Error ? error.message : String(error); + const errorDetails = error instanceof Error ? { + name: error.name, + message: error.message, + stack: error.stack?.substring(0, 200), // First 200 chars of stack + } : { raw: String(error) }; + logger.error('Error discovering Infomaniak calendars', { email, - error: error instanceof Error ? error.message : String(error), + error: errorMessage, + errorDetails, }); // Ne pas faire échouer toute la page agenda si la découverte échoue // On retourne simplement une liste vide -> pas de sync auto possible diff --git a/lib/services/microsoft-oauth.ts b/lib/services/microsoft-oauth.ts index 877f716..ad148f9 100644 --- a/lib/services/microsoft-oauth.ts +++ b/lib/services/microsoft-oauth.ts @@ -51,7 +51,8 @@ export async function exchangeCodeForTokens(code: string): Promise<{ client_secret: clientSecret!, code, redirect_uri: redirectUri!, - grant_type: 'authorization_code' + grant_type: 'authorization_code', + scope: REQUIRED_SCOPES // Include scopes in token exchange }); try {