@@ -65,7 +65,7 @@ from azure.identity import DeviceCodeCredential
6565
6666credential = DeviceCodeCredential(" client_id" ,
6767 " tenant_id" )
68- graph_scopes = [' User.Read ' , ' Calendars.ReadWrite.Shared ' ]
68+ scopes = [' https://graph.microsoft.com/.default ' ]
6969```
7070
7171### 2.3 Initialize a GraphServiceClient object
@@ -97,7 +97,7 @@ credentials = DeviceCodeCredential(
9797 ' CLIENT_ID' ,
9898 ' TENANT_ID' ,
9999)
100- scopes = [' User.Read ' , ' Mail.Read ' ]
100+ scopes = [' https://graph.microsoft.com/.default ' ]
101101client = GraphServiceClient(credentials = credentials, scopes = scopes)
102102```
103103
@@ -121,7 +121,7 @@ credential = ClientSecretCredential(
121121 ' client_id' ,
122122 ' client_secret'
123123)
124- scopes = [' https://graph.microsoft.com/.default ' ]
124+ scopes = [" User.Read " ]
125125client = GraphServiceClient(credentials = credential, scopes = scopes)
126126
127127# GET /users/{id | userPrincipalName}
@@ -139,8 +139,11 @@ import asyncio
139139from azure.identity import InteractiveBrowserCredential
140140from msgraph import GraphServiceClient
141141
142- credential = InteractiveBrowserCredential()
143- scopes= [' User.Read' ]
142+ credential = InteractiveBrowserCredential(
143+ client_id = os.getenv(' client_id' ),
144+ tenant_id = os.getenv(' tenant_id' ),
145+ )
146+ scopes = [" User.Read" ]
144147client = GraphServiceClient(credentials = credential, scopes = scopes,)
145148
146149# GET /me
0 commit comments