Skip to content

Commit cd4f3ef

Browse files
committed
fix scopes
1 parent 3a71f92 commit cd4f3ef

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

apps/sim/blocks/blocks/microsoft_teams.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export const MicrosoftTeamsBlock: BlockConfig<MicrosoftTeamsResponse> = {
4747
'Channel.ReadBasic.All',
4848
'ChannelMessage.Send',
4949
'ChannelMessage.Read.All',
50+
'ChannelMember.Read.All',
5051
'Group.Read.All',
5152
'Group.ReadWrite.All',
5253
'Team.ReadBasic.All',

apps/sim/lib/auth.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,7 @@ export const auth = betterAuth({
512512
'Channel.ReadBasic.All',
513513
'ChannelMessage.Send',
514514
'ChannelMessage.Read.All',
515+
'ChannelMember.Read.All',
515516
'Group.Read.All',
516517
'Group.ReadWrite.All',
517518
'Team.ReadBasic.All',

apps/sim/lib/oauth/oauth.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ export const OAUTH_PROVIDERS: Record<string, OAuthProviderConfig> = {
239239
'Channel.ReadBasic.All',
240240
'ChannelMessage.Send',
241241
'ChannelMessage.Read.All',
242+
'ChannelMember.Read.All',
242243
'Group.Read.All',
243244
'Group.ReadWrite.All',
244245
'Team.ReadBasic.All',

apps/sim/tools/microsoft_teams/utils.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,8 @@ async function fetchChannelMembers(
180180
channelId: string,
181181
accessToken: string
182182
): Promise<TeamMember[]> {
183-
// Channel members endpoint requires ChannelMember.Read.All which may not be available
184-
// Instead, fetch team members which works with the standard Teams permissions
185183
const response = await fetch(
186-
`https://graph.microsoft.com/v1.0/teams/${encodeURIComponent(teamId)}/members`,
184+
`https://graph.microsoft.com/v1.0/teams/${encodeURIComponent(teamId)}/channels/${encodeURIComponent(channelId)}/members`,
187185
{
188186
headers: {
189187
Authorization: `Bearer ${accessToken}`,
@@ -193,7 +191,7 @@ async function fetchChannelMembers(
193191
)
194192

195193
if (!response.ok) {
196-
logger.error('Failed to fetch team members:', {
194+
logger.error('Failed to fetch channel members:', {
197195
status: response.status,
198196
statusText: response.statusText,
199197
})
@@ -207,7 +205,7 @@ async function fetchChannelMembers(
207205
userIdentityType: member.userIdentityType,
208206
}))
209207

210-
logger.info('Fetched team members for channel:', {
208+
logger.info('Fetched channel members:', {
211209
count: members.length,
212210
members: members.map((m: TeamMember) => ({
213211
displayName: m.displayName,

0 commit comments

Comments
 (0)