File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed
Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -121,7 +121,7 @@ credential = ClientSecretCredential(
121121 ' client_id' ,
122122 ' client_secret'
123123)
124- scopes = [' https://graph.microsoft.com/.default ' ]
124+ scopes = [" User.ReadWrite " ]
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 = [' https://graph.microsoft.com/.default' ]
142+ credential = InteractiveBrowserCredential(
143+ client_id = os.getenv(' client_id' ),
144+ tenant_id = os.getenv(' tenant_id' ),
145+ )
146+ scopes = [" User.ReadWrite" ]
144147client = GraphServiceClient(credentials = credential, scopes = scopes,)
145148
146149# GET /me
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ credential = DeviceCodeCredential(
1414 tenant_id = ' TENANT_ID' ,
1515 )
1616
17- scopes = [' https://graph.microsoft.com/.default ' ]
17+ scopes = [" User.ReadWrite " ]
1818
1919# Create an API client with the credentials and scopes.
2020client = GraphServiceClient(credentials = credential, scopes = scopes)
@@ -35,8 +35,12 @@ from azure.identity import InteractiveBrowserCredential
3535from msgraph import GraphServiceClient
3636
3737# Create a credential object. Used to authenticate requests
38- credential = InteractiveBrowserCredential()
39- scopes = [' https://graph.microsoft.com/.default' ]
38+ credentials = InteractiveBrowserCredential(
39+ client_id = os.getenv(' client_id' ),
40+ tenant_id = os.getenv(' tenant_id' ),
41+ )
42+
43+ scopes = [" User.ReadWrite" ]
4044
4145# Create an API client with the credentials and scopes.
4246client = GraphServiceClient(credentials = credential, scopes = scopes)
You can’t perform that action at this time.
0 commit comments