没有这样做的文件,我发现这是不可接受的.
from msal import ConfidentialClientApplication
from msgraph import GraphServiceClient
client_id = ''
client_secret = ''
tenant_id = ''
authority = f'https://login.microsoftonline.com/{tenant_id}'
scopes = ['https://graph.microsoft.com/.default']
app = ConfidentialClientApplication(
client_id,
authority=authority,
client_credential=client_secret,
)
response = app.acquire_token_for_client(scopes)
graph_client = GraphServiceClient(
credentials=response,
scopes=scopes
)
await graph_client.users.get()
/usr/local/lib/python3.10/dist-packages/kiota_authentication_azure/azure_identity_access_token_provider.py in get_authorization_token(self, uri, additional_authentication_context)
101 )
102 else:
--> 103 result = self._credentials.get_token(*self._scopes, claims=decoded_claim)
104
105 if inspect.isawaitable(result):
> AttributeError: 'dict' object has no attribute 'get_token'
Analyzing the stack, you can see that the object passed as credentials in the `msgraph` client is not what it expects; `acquire_token_for_client` returns a dictionary, but `GraphServiceClient` expects it to have a function called "get_token."
如何解决这个问题?