Skip to content

Commit f26d4ac

Browse files
committed
Removed async wrapper for DeviceCodeCredential
1 parent 88a787b commit f26d4ac

File tree

2 files changed

+4
-28
lines changed

2 files changed

+4
-28
lines changed

user-auth/graphtutorial/async_auth.py

Lines changed: 0 additions & 24 deletions
This file was deleted.

user-auth/graphtutorial/graph.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Licensed under the MIT License.
33

44
# <UserAuthConfigSnippet>
5+
from azure.identity import DeviceCodeCredential
56
from configparser import SectionProxy
67
from kiota_authentication_azure.azure_identity_authentication_provider import (
78
AzureIdentityAuthenticationProvider)
@@ -15,11 +16,10 @@
1516
from msgraph.generated.models.body_type import BodyType
1617
from msgraph.generated.models.recipient import Recipient
1718
from msgraph.generated.models.email_address import EmailAddress
18-
from async_auth import AsyncDeviceCodeCredential
1919

2020
class Graph:
2121
settings: SectionProxy
22-
device_code_credential: AsyncDeviceCodeCredential
22+
device_code_credential: DeviceCodeCredential
2323
adapter: GraphRequestAdapter
2424
user_client: GraphServiceClient
2525

@@ -29,7 +29,7 @@ def __init__(self, config: SectionProxy):
2929
tenant_id = self.settings['tenantId']
3030
graph_scopes = self.settings['graphUserScopes'].split(' ')
3131

32-
self.device_code_credential = AsyncDeviceCodeCredential(client_id, tenant_id = tenant_id)
32+
self.device_code_credential = DeviceCodeCredential(client_id, tenant_id = tenant_id)
3333
auth_provider = AzureIdentityAuthenticationProvider(
3434
self.device_code_credential,
3535
scopes=graph_scopes)
@@ -40,7 +40,7 @@ def __init__(self, config: SectionProxy):
4040
# <GetUserTokenSnippet>
4141
async def get_user_token(self):
4242
graph_scopes = self.settings['graphUserScopes']
43-
access_token = await self.device_code_credential.get_token(graph_scopes)
43+
access_token = self.device_code_credential.get_token(graph_scopes)
4444
return access_token.token
4545
# </GetUserTokenSnippet>
4646

0 commit comments

Comments
 (0)