You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 32c06c0
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: README.md
+24-53Lines changed: 24 additions & 53 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,60 +19,39 @@ pip install msgraph-sdk
19
19
20
20
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).
21
21
22
-
### 2.2 Create an AuthenticationProvider object
22
+
### 2.2 Initialize a GraphServiceClient object
23
23
24
-
An instance of the **GraphServiceClient**class handles building client. To create a new instance of this class, you need to provide an instance of **AuthenticationProvider**, which can authenticate requests to Microsoft Graph.
24
+
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.
25
25
26
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.
27
27
28
28
```py
29
-
# Example using async credentials.
30
-
from azure.identity.aio import DefaultAzureCredential
31
-
from kiota_authentication_azure.azure_identity_authentication_provider import AzureIdentityAuthenticationProvider
The above example uses default scopes for [app-only access](https://learn.microsoft.com/en-us/graph/permissions-overview#delegated-permissions). If using [delegated access](https://learn.microsoft.com/en-us/graph/permissions-overview#delegated-permissions) you can provide custom scopes:
You must get a **GraphServiceClient** object to make requests against the service.
42
+
The above example uses default scopes for [app-only access](https://learn.microsoft.com/en-us/graph/permissions-overview?tabs=http#application-permissions). If using [delegated access](https://learn.microsoft.com/en-us/graph/permissions-overview#delegated-permissions) you can provide custom scopes:
71
43
72
44
```py
45
+
# Example using sync credentials and delegated access.
user =await client.users.by_user_id('userPrincipalName').get()
@@ -108,20 +83,16 @@ async def get_user():
108
83
asyncio.run(get_user())
109
84
```
110
85
111
-
Note that to calling `me` requires a signed-in user and therefore delegated permissions. See [Authenticating Users](https://learn.microsoft.com/en-us/python/api/overview/azure/identity-readme?view=azure-python#authenticate-users)) for more:
86
+
Note that to calling `me` requires a signed-in user and therefore delegated permissions. See [Authenticating Users](https://learn.microsoft.com/en-us/python/api/overview/azure/identity-readme?view=azure-python#authenticate-users) for more:
112
87
113
88
```py
114
89
import asyncio
115
90
from azure.identity import InteractiveBrowserCredential
116
-
from kiota_authentication_azure.azure_identity_authentication_provider import AzureIdentityAuthenticationProvider
0 commit comments