无法将MSGraph与python MSAL一起使用

2024-05-29 03:02:20 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试开发一个简单的应用程序,它将从crontab启动。 这个应用程序必须连接到我的outlook(Office360)日历并下载所有事件,之后我将插入我的MariaDb。 我以为那很容易,但我在过去的4天里失去了理智。 我尝试使用NodeJs来跟踪Microsoft doc,但是我找不到一种静默模式(一种在没有登录的情况下请求身份验证的模式)来接收令牌和数据。 然后我尝试用不同的方法使用Python,首先使用EWS,但是我读到这将在将来被弃用,在过去的2天里,我尝试使用MSAL和ADAL。 MSAL方法看起来更分散,但当我同时使用acquire_token_by_username_password或{}启动脚本时,仍然存在这个问题

AADSTS7000218: The request body must contain the following parameter: 'client_assertion' or 'client_secret'.

我的代码与GitHub https://github.com/AzureAD/microsoft-authentication-library-for-python/tree/dev/sample相同 我改变了我的配置parameter.json参数并插入我的:

{
    "authority": "https://login.microsoftonline.com/organizations",
    "client_id": "ClinetIdOfApp Set in Azure",
    "username": "myaccont@account.xx",
    "scope": ["User.Read","Calendars.Read"],
    "password": "MyPassword*****"
}

拜托,有谁能告诉我跳这块石头的建议吗? 谢谢


Tags: 方法httpscomclient应用程序readparameter模式
1条回答
网友
1楼 · 发布于 2024-05-29 03:02:20

您正在使用资源所有者密码凭据,您需要将应用程序视为公共客户端。在

登录Azure门户->单击Azure Active Directory->单击应用程序注册->查找应用程序->单击身份验证->将默认客户端类型更改为公共客户端。在

enter image description here

结果是:

enter image description here

相关问题 更多 >

    热门问题