Skip to content

Commit 7255a8e

Browse files
vogtnnmetulev
andauthored
[teams-channel-picker] updating scopes (#1386)
Co-authored-by: Nikola Metulev <[email protected]>
1 parent d92acdc commit 7255a8e

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

packages/mgt-components/src/components/mgt-teams-channel-picker/mgt-teams-channel-picker.graph.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ import { Team } from '@microsoft/microsoft-graph-types';
1515
* @memberof Graph
1616
*/
1717
export async function getAllMyTeams(graph: IGraph): Promise<Team[]> {
18-
const teams = await graph.api('/me/joinedTeams').select(['displayName', 'id', 'isArchived']).get();
18+
const scopes = 'team.readbasic.all';
19+
const teams = await graph
20+
.api('/me/joinedTeams')
21+
.select(['displayName', 'id', 'isArchived'])
22+
.middlewareOptions(prepScopes(scopes))
23+
.get();
1924
return teams ? teams.value : null;
2025
}

packages/mgt-components/src/components/mgt-teams-channel-picker/mgt-teams-channel-picker.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,9 +653,10 @@ export class MgtTeamsChannelPicker extends MgtTemplatedComponent {
653653
teams = teams.filter(t => !t.isArchived);
654654

655655
const batch = graph.createBatch();
656+
const scopes = ['team.readbasic.all'];
656657

657658
for (const team of teams) {
658-
batch.get(team.id, `teams/${team.id}/channels`);
659+
batch.get(team.id, `teams/${team.id}/channels`, scopes);
659660
}
660661

661662
const responses = await batch.executeAll();

packages/mgt-element/src/providers/SimpleProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export class SimpleProvider extends IProvider {
5353
* @memberof SimpleProvider
5454
*/
5555
public getAccessToken(options?: AuthenticationProviderOptions): Promise<string> {
56-
return this._getAccessTokenHandler(options.scopes);
56+
return this._getAccessTokenHandler(options?.scopes);
5757
}
5858

5959
/**

0 commit comments

Comments
 (0)