Skip to content

Commit 3c480e3

Browse files
authored
Update README.md
1 parent 6504657 commit 3c480e3

1 file changed

Lines changed: 9 additions & 13 deletions

File tree

‎README.md‎

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ pip install msgraph-sdk
1919

2020
Register your application by following the steps at [Register your app with the Microsoft Identity Platform](https://docs.microsoft.com/graph/auth-register-app-v2).
2121

22-
### 2.2 Select an authentication provider
22+
### 2.2 Select and create an authentication provider
2323

24-
To start writing code and making requests to the Microsoft Graph service, you need to set up an authentication provider. This object will authenticate your requests to Microsoft Graph. For authentication, the Microsoft Graph Python SDK supports both sync and async credential classes from Azure Identity. Which library to choose depends on the type of application you are building.
24+
To start writing code and making requests to the Microsoft Graph service, you need to set up an authentication provider. This object will authenticate your requests to Microsoft Graph. For authentication, the Microsoft Graph Python SDK supports both sync and async credential classes from Azure Identity. Which library to choose depends on the type of application you are building.
25+
26+
> **Note**: For authentication we support both `sync` and `async` credential classes from `azure.identity`. Please see the azure identity [docs](https://learn.microsoft.com/en-us/python/api/azure-identity/azure.identity?view=azure-python) for more information.
2527
2628
The easiest way to filter this decision is by looking at the permissions set you'd use. Microsoft Graph supports 2 different types of permissions: delegated and application permissions:
2729
- Application permissions are used when you don’t need a user to login to your app, but the app will perform tasks on its own and run in the background.
@@ -42,42 +44,36 @@ Once you've picked an authentication library, we can initiate the authentication
4244
import asyncio
4345

4446
from azure.identity.aio import ClientSecretCredential
45-
from kiota_authentication_azure.azure_identity_authentication_provider import AzureIdentityAuthenticationProvider
4647

4748
credential = ClientSecretCredential("tenantID",
4849
"clientID",
4950
"clientSecret")
5051
scopes = ['https://graph.microsoft.com/.default']
51-
auth_provider = AzureIdentityAuthenticationProvider(credential, scopes=scopes)
5252
```
5353

5454
The following example uses DeviceCodeCredentials with delegated permissions.
5555
```python
5656
import asyncio
5757

5858
from azure.identity import DeviceCodeCredential
59-
from kiota_authentication_azure.azure_identity_authentication_provider import AzureIdentityAuthenticationProvider
6059

6160
credential = DeviceCodeCredential(client_id, tenant_id)
6261
graph_scopes = ['User.Read', 'Calendars.ReadWrite.Shared']
63-
auth_provider = AzureIdentityAuthenticationProvider(credential, scopes=graph_scopes)
6462
```
6563

6664
### 2.3 Initialize a GraphServiceClient object
6765

6866
You must create **GraphServiceClient** object to make requests against the service. To create a new instance of this class, you need to provide credentials and scopes, which can authenticate requests to Microsoft Graph.
6967

70-
> **Note**: For authentication we support both `sync` and `async` credential classes from `azure.identity`. Please see the azure identity [docs](https://learn.microsoft.com/en-us/python/api/azure-identity/azure.identity?view=azure-python) for more information.
71-
7268
```py
7369
# Example using async credentials and application access.
7470
from azure.identity.aio import ClientSecretCredential
7571
from msgraph import GraphServiceClient
7672

7773
credential = ClientSecretCredential(
78-
tenant_id='TENANT_ID',
79-
client_id='CLIENT_ID',
80-
client_secret='CLIENT_SECRET',
74+
'TENANT_ID',
75+
'CLIENT_ID',
76+
'CLIENT_SECRET',
8177
)
8278
scopes = ['https://graph.microsoft.com/.default']
8379
client = GraphServiceClient(credentials=credential, scopes=scopes)
@@ -91,8 +87,8 @@ from azure.identity import DeviceCodeCredential
9187
from msgraph import GraphServiceClient
9288

9389
credential=DeviceCodeCredential(
94-
client_id='CLIENT_ID',
95-
tenant_id='TENANT_ID',
90+
'CLIENT_ID',
91+
'TENANT_ID',
9692
)
9793
scopes = ['User.Read', 'Mail.Read']
9894
client = GraphServiceClient(credentials=credential, scopes=scopes)

0 commit comments

Comments
 (0)