Skip to content

Commit 103703e

Browse files
committed
feat(outlook): add Calendars.ReadWrite and MailboxSettings.Read scopes
Extend the shared outlook OAuth service with delegated Graph calendar scopes so one Microsoft connection covers mail and calendar. Existing connected users must reconnect to be granted the new scopes (noted in a code comment). Adds human-readable scope descriptions and test assertions.
1 parent 5b7cf99 commit 103703e

3 files changed

Lines changed: 13 additions & 1 deletion

File tree

apps/sim/lib/oauth/oauth.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,10 +392,16 @@ export const OAUTH_PROVIDERS: Record<string, OAuthProviderConfig> = {
392392
},
393393
outlook: {
394394
name: 'Outlook',
395-
description: 'Connect to Outlook and manage emails.',
395+
description: 'Connect to Outlook and manage emails and calendar events.',
396396
providerId: 'outlook',
397397
icon: OutlookIcon,
398398
baseProviderIcon: MicrosoftIcon,
399+
/**
400+
* Calendars.ReadWrite and MailboxSettings.Read were added to support the Outlook
401+
* calendar operations. Microsoft only grants newly-added scopes on a fresh
402+
* authorization, so users who connected Outlook before these scopes existed must
403+
* reconnect (re-consent) their account before the calendar operations will work.
404+
*/
399405
scopes: [
400406
'openid',
401407
'profile',
@@ -404,6 +410,8 @@ export const OAUTH_PROVIDERS: Record<string, OAuthProviderConfig> = {
404410
'Mail.ReadBasic',
405411
'Mail.Read',
406412
'Mail.Send',
413+
'Calendars.ReadWrite',
414+
'MailboxSettings.Read',
407415
'offline_access',
408416
],
409417
},

apps/sim/lib/oauth/utils.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ describe('getCanonicalScopesForProvider', () => {
335335

336336
expect(outlookScopes.length).toBeGreaterThan(0)
337337
expect(outlookScopes).toContain('Mail.ReadWrite')
338+
expect(outlookScopes).toContain('Calendars.ReadWrite')
338339

339340
const excelScopes = getCanonicalScopesForProvider('microsoft-excel')
340341

@@ -618,6 +619,7 @@ describe('getScopesForService', () => {
618619

619620
expect(scopes.length).toBeGreaterThan(0)
620621
expect(scopes).toContain('Mail.ReadWrite')
622+
expect(scopes).toContain('Calendars.ReadWrite')
621623
})
622624

623625
it.concurrent('should return empty array for empty string', () => {

apps/sim/lib/oauth/utils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,8 @@ export const SCOPE_DESCRIPTIONS: Record<string, string> = {
237237
'Mail.ReadBasic': 'Read Microsoft emails',
238238
'Mail.Read': 'Read Microsoft emails',
239239
'Mail.Send': 'Send emails',
240+
'Calendars.ReadWrite': 'Read and manage Outlook calendar events',
241+
'MailboxSettings.Read': 'Read mailbox settings (timezone, working hours)',
240242
'Files.Read': 'Read OneDrive files',
241243
'Files.ReadWrite': 'Read and write OneDrive files',
242244
'Tasks.ReadWrite': 'Read and manage Planner tasks',

0 commit comments

Comments
 (0)